2 package Class::MOP::Method::Generated;
10 our $VERSION = '1.11';
11 $VERSION = eval $VERSION;
12 our $AUTHORITY = 'cpan:STEVAN';
14 use base 'Class::MOP::Method';
19 confess __PACKAGE__ . " is an abstract base class, you must provide a constructor.";
22 sub _initialize_body {
23 confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";
26 sub _generate_description {
27 my ( $self, $context ) = @_;
28 $context ||= $self->definition_context;
30 return "generated method (unknown origin)"
31 unless defined $context;
33 if (defined $context->{description}) {
34 return "$context->{description} "
35 . "(defined at $context->{file} line $context->{line})";
37 return "$context->{file} (line $context->{line})";
42 my ( $self, @args ) = @_;
43 unshift @args, 'source' if @args % 2;
46 my $context = delete $args{context};
47 my $environment = $self->can('_eval_environment')
48 ? $self->_eval_environment
52 environment => $environment,
53 description => $self->_generate_description($context),
66 Class::MOP::Method::Generated - Abstract base class for generated methods
70 This is a C<Class::MOP::Method> subclass which is subclassed by
71 C<Class::MOP::Method::Accessor> and
72 C<Class::MOP::Method::Constructor>.
74 It is not intended to be used directly.
78 Stevan Little E<lt>stevan@iinteractive.comE<gt>
80 =head1 COPYRIGHT AND LICENSE
82 Copyright 2006-2010 by Infinity Interactive, Inc.
84 L<http://www.iinteractive.com>
86 This library is free software; you can redistribute it and/or modify
87 it under the same terms as Perl itself.