2 package Class::MOP::Method::Generated;
10 use base 'Class::MOP::Method';
15 confess __PACKAGE__ . " is an abstract base class, you must provide a constructor.";
18 sub _initialize_body {
19 confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";
22 sub _generate_description {
23 my ( $self, $context ) = @_;
24 $context ||= $self->definition_context;
26 return "generated method (unknown origin)"
27 unless defined $context;
29 if (defined $context->{description}) {
30 return "$context->{description} "
31 . "(defined at $context->{file} line $context->{line})";
33 return "$context->{file} (line $context->{line})";
38 my ( $self, @args ) = @_;
39 unshift @args, 'source' if @args % 2;
42 my $context = delete $args{context};
43 my $environment = $self->can('_eval_environment')
44 ? $self->_eval_environment
48 environment => $environment,
49 description => $self->_generate_description($context),
62 Class::MOP::Method::Generated - Abstract base class for generated methods
66 This is a C<Class::MOP::Method> subclass which is subclassed by
67 C<Class::MOP::Method::Accessor> and
68 C<Class::MOP::Method::Constructor>.
70 It is not intended to be used directly.