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