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