okay, this is not meant to be used, but since i am not using svk or anything, I have...
[gitmo/Class-MOP.git] / lib / Class / MOP / Method / Generated.pm
CommitLineData
565f0cbb 1
2package Class::MOP::Method::Generated;
3
4use strict;
5use warnings;
6
7use Carp 'confess';
8
9our $VERSION = '0.01';
10our $AUTHORITY = 'cpan:STEVAN';
11
12use base 'Class::MOP::Method';
13
14sub new {
15 my $class = shift;
16 my %options = @_;
17
18 my $self = bless {
19 # from our superclass
20 '&!body' => undef,
4c105333 21 '$!package_name' => $options{package_name},
22 '$!name' => $options{name},
565f0cbb 23 # specific to this subclass
24 '$!is_inline' => ($options{is_inline} || 0),
25 } => $class;
26
27 $self->initialize_body;
28
29 return $self;
30}
31
32## accessors
33
34sub is_inline { (shift)->{'$!is_inline'} }
35
36sub initialize_body {
37 confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";
38}
39
40
41
421;
43
44__END__
45
46=pod
47
48=head1 NAME
49
50Class::MOP::Method::Generated - Abstract base class for generated methods
51
52=head1 DESCRIPTION
53
54This is a C<Class::MOP::Method> subclass which is used interally
55by C<Class::MOP::Method::Accessor> and C<Class::MOP::Method::Constructor>.
56
57=head1 METHODS
58
59=over 4
60
61=item B<new (%options)>
62
63This creates the method based on the criteria in C<%options>,
64these options are:
65
66=over 4
67
68=item I<is_inline>
69
70This is a boolean to indicate if the method should be generated
71as a closure, or as a more optimized inline version.
72
73=back
74
75=item B<is_inline>
76
77This returns the boolean which was passed into C<new>.
78
79=item B<initialize_body>
80
81This is an abstract method and will throw an exception if called.
82
83=back
84
85=head1 AUTHORS
86
87Stevan Little E<lt>stevan@iinteractive.comE<gt>
88
89=head1 COPYRIGHT AND LICENSE
90
69e3ab0a 91Copyright 2006-2008 by Infinity Interactive, Inc.
565f0cbb 92
93L<http://www.iinteractive.com>
94
95This library is free software; you can redistribute it and/or modify
96it under the same terms as Perl itself.
97
98=cut
99