1Class::MOP::Method(3) User Contributed Perl DocumentationClass::MOP::Method(3)
2
3
4

NAME

6       Class::MOP::Method - Method Meta Object
7

DESCRIPTION

9       The Method Protocol is very small, since methods in Perl 5 are just
10       subroutines in a specific package. We provide a very basic
11       introspection interface.
12

METHODS

14       Class::MOP::Method->wrap($code, %options)
15           This is the constructor. It accepts a method body in the form of
16           either a code reference or a Class::MOP::Method instance, followed
17           by a hash of options.
18
19           The options are:
20
21           ·       name
22
23                   The method name (without a package name). This is required
24                   if $code is a coderef.
25
26           ·       package_name
27
28                   The package name for the method. This is required if $code
29                   is a coderef.
30
31           ·       associated_metaclass
32
33                   An optional Class::MOP::Class object. This is the metaclass
34                   for the method's class.
35
36       $metamethod->clone(%params)
37           This makes a shallow clone of the method object. In particular,
38           subroutine reference itself is shared between all clones of a given
39           method.
40
41           When a method is cloned, the original method object will be
42           available by calling "original_method" on the clone.
43
44       $metamethod->body
45           This returns a reference to the method's subroutine.
46
47       $metamethod->name
48           This returns the method's name
49
50       $metamethod->package_name
51           This returns the method's package name.
52
53       $metamethod->fully_qualified_name
54           This returns the method's fully qualified name (package name and
55           method name).
56
57       $metamethod->associated_metaclass
58           This returns the Class::MOP::Class object for the method, if one
59           exists.
60
61       $metamethod->original_method
62           If this method object was created as a clone of some other method
63           object, this returns the object that was cloned.
64
65       $metamethod->original_name
66           This returns the method's original name, wherever it was first
67           defined.
68
69           If this method is a clone of a clone (of a clone, etc.), this
70           method returns the name from the first method in the chain of
71           clones.
72
73       $metamethod->original_package_name
74           This returns the method's original package name, wherever it was
75           first defined.
76
77           If this method is a clone of a clone (of a clone, etc.), this
78           method returns the package name from the first method in the chain
79           of clones.
80
81       $metamethod->original_fully_qualified_name
82           This returns the method's original fully qualified name, wherever
83           it was first defined.
84
85           If this method is a clone of a clone (of a clone, etc.), this
86           method returns the fully qualified name from the first method in
87           the chain of clones.
88
89       $metamethod->attach_to_class($metaclass)
90           Given a Class::MOP::Class object, this method sets the associated
91           metaclass for the method. This will overwrite any existing
92           associated metaclass.
93
94       $metamethod->detach_from_class
95           Removes any associated metaclass object for the method.
96
97       $metamethod->execute(...)
98           This executes the method. Any arguments provided will be passed on
99           to the method itself.
100
101       Class::MOP::Method->meta
102           This will return a Class::MOP::Class instance for this class.
103
104           It should also be noted that Class::MOP will actually bootstrap
105           this module by installing a number of attribute meta-objects into
106           its metaclass.
107

AUTHORS

109       Stevan Little <stevan@iinteractive.com>
110
112       Copyright 2006-2010 by Infinity Interactive, Inc.
113
114       <http://www.iinteractive.com>
115
116       This library is free software; you can redistribute it and/or modify it
117       under the same terms as Perl itself.
118
119
120
121perl v5.12.2                      2010-09-13             Class::MOP::Method(3)
Impressum