Class::MOP - refactoring the binary tree test code
[gitmo/Class-MOP.git] / lib / Class / MOP / Method.pm
CommitLineData
8b978dd5 1
2package Class::MOP::Method;
3
4use strict;
5use warnings;
6
2eb717d5 7use Carp 'confess';
8use Scalar::Util 'reftype';
9
10use Class::MOP::Class;
11
8b978dd5 12our $VERSION = '0.01';
2eb717d5 13
14sub meta { Class::MOP::Class->initialize($_[0]) }
15
16sub 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
261;
27
28__END__
29
30=pod
31
32=head1 NAME
33
34Class::MOP::Method - Method Meta Object
35
36=head1 SYNOPSIS
37
38=head1 DESCRIPTION
39
552e3d24 40The Method Protocol is very small, since methods in Perl 5 are just
41subroutines within the particular package. Basically all we do is to
42bless the subroutine and provide some very simple introspection
43methods 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
57Stevan Little E<gt>stevan@iinteractive.comE<lt>
58
59=head1 COPYRIGHT AND LICENSE
60
61Copyright 2006 by Infinity Interactive, Inc.
62
63L<http://www.iinteractive.com>
64
65This library is free software; you can redistribute it and/or modify
66it under the same terms as Perl itself.
67
68=cut