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