preping for the 0.01 release
[gitmo/Class-MOP.git] / lib / Class / MOP / Method.pm
1
2 package Class::MOP::Method;
3
4 use strict;
5 use warnings;
6
7 use Carp         'confess';
8 use Scalar::Util 'reftype';
9
10 our $VERSION = '0.01';
11
12 sub meta { 
13     require Class::MOP::Class;
14     Class::MOP::Class->initialize($_[0]) 
15 }
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 }
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   # ... more to come later maybe
40
41 =head1 DESCRIPTION
42
43 The Method Protocol is very small, since methods in Perl 5 are just 
44 subroutines within the particular package. Basically all we do is to 
45 bless the subroutine. 
46
47 Currently this package is largely unused. Future plans are to provide 
48 some very simple introspection methods for the methods themselves. 
49 Suggestions for this are welcome. 
50
51 =head1 METHODS
52
53 =over 4
54
55 =item B<wrap (&code)>
56
57 This simply blesses the C<&code> reference passed to it.
58
59 =item B<meta>
60
61 This will return a B<Class::MOP::Class> instance which is related 
62 to this class.
63
64 =back
65
66 =head1 AUTHOR
67
68 Stevan Little E<lt>stevan@iinteractive.comE<gt>
69
70 =head1 COPYRIGHT AND LICENSE
71
72 Copyright 2006 by Infinity Interactive, Inc.
73
74 L<http://www.iinteractive.com>
75
76 This library is free software; you can redistribute it and/or modify
77 it under the same terms as Perl itself. 
78
79 =cut