Commit | Line | Data |
8b978dd5 |
1 | |
2 | package Class::MOP::Method; |
3 | |
4 | use strict; |
5 | use warnings; |
6 | |
2eb717d5 |
7 | use Carp 'confess'; |
8 | use Scalar::Util 'reftype'; |
9 | |
10 | use Class::MOP::Class; |
11 | |
8b978dd5 |
12 | our $VERSION = '0.01'; |
2eb717d5 |
13 | |
14 | sub meta { Class::MOP::Class->initialize($_[0]) } |
15 | |
16 | sub wrap { |
17 | my $class = shift; |
18 | my $code = shift; |
19 | |
20 | (reftype($code) && reftype($code) eq 'CODE') |
21 | || confess "You must supply a CODE reference to wrap"; |
22 | |
23 | bless $code => $class; |
24 | } |
8b978dd5 |
25 | |
26 | 1; |
27 | |
28 | __END__ |
29 | |
30 | =pod |
31 | |
32 | =head1 NAME |
33 | |
34 | Class::MOP::Method - Method Meta Object |
35 | |
36 | =head1 SYNOPSIS |
37 | |
38 | =head1 DESCRIPTION |
39 | |
552e3d24 |
40 | The Method Protocol is very small, since methods in Perl 5 are just |
41 | subroutines within the particular package. Basically all we do is to |
42 | bless the subroutine and provide some very simple introspection |
43 | methods for it. |
44 | |
2eb717d5 |
45 | =head1 METHODS |
46 | |
47 | =over 4 |
48 | |
49 | =item B<wrap (&code)> |
50 | |
51 | =item B<meta> |
52 | |
53 | =back |
54 | |
8b978dd5 |
55 | =head1 AUTHOR |
56 | |
57 | Stevan Little E<gt>stevan@iinteractive.comE<lt> |
58 | |
59 | =head1 COPYRIGHT AND LICENSE |
60 | |
61 | Copyright 2006 by Infinity Interactive, Inc. |
62 | |
63 | L<http://www.iinteractive.com> |
64 | |
65 | This library is free software; you can redistribute it and/or modify |
66 | it under the same terms as Perl itself. |
67 | |
68 | =cut |