use base 'Class::MOP::Method::Attribute';
-sub _initialize_body {
- my $self = shift;
-
- my $method_name = join "_" => (
- '_generate',
- 'method',
- ($self->is_inline ? 'inline' : ())
- );
-
- $self->{'body'} = $self->$method_name();
-}
-
## generators
-sub generate_method {
- Carp::cluck('The generate_accessor_method method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method;
-}
-
sub _generate_method {
my $attr = (shift)->associated_attribute;
return sub {
## Inline methods
-sub generate_method_inline {
- Carp::cluck('The generate_accessor_method_inline method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method_inline;
-}
-
sub _generate_method_inline {
my $self = shift;
my $attr = $self->associated_attribute;
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
-use base 'Class::MOP::Method::Generated';
+use base 'Class::MOP::Method::Inlined';
sub new {
my $class = shift;
## factory
-sub initialize_body {
- Carp::cluck('The initialize_body method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_initialize_body;
-}
-
1;
# XXX - UPDATE DOCS
use base 'Class::MOP::Method::Attribute';
-sub _initialize_body {
- my $self = shift;
-
- my $method_name = join "_" => (
- '_generate',
- 'method',
- ($self->is_inline ? 'inline' : ())
- );
-
- $self->{'body'} = $self->$method_name();
-}
-
## generators
-sub generate_method {
- Carp::cluck('The generate_clearer_method method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method;
-}
-
sub _generate_method {
my $attr = (shift)->associated_attribute;
return sub {
## Inline methods
-sub generate_method_inline {
- Carp::cluck('The generate_clearer_method_inline method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method_inline;
-}
-
sub _generate_method_inline {
my $self = shift;
my $attr = $self->associated_attribute;
## accessors
+# FIXME refactor into a trait when those are introduced to Class::MOP
+
sub new {
confess __PACKAGE__ . " is an abstract base class, you must provide a constructor.";
}
-sub is_inline { $_[0]{is_inline} }
-
-sub definition_context { $_[0]{definition_context} }
-
sub _initialize_body {
confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";
}
sub body {
my $self = shift;
- $self->{'body'} ||= do {
- $self->_initialize_body;
- };
-
- return $self->{'body'};
+ $self->{'body'} ||= $self->_initialize_body;
}
sub _eval_closure {
return $self->_eval_closure($args{environment}, $code);
}
+sub generate_method {
+ Carp::cluck('The generate_reader_method method has been made private.'
+ . " The public version is deprecated and will be removed in a future release.\n");
+ shift->_generate_method;
+}
+
+sub generate_method_inline {
+ Carp::cluck('The generate_reader_method_inline method has been made private.'
+ . " The public version is deprecated and will be removed in a future release.\n");
+ shift->_generate_method_inline;
+}
+
+sub initialize_body {
+ Carp::cluck('The initialize_body method has been made private.'
+ . " The public version is deprecated and will be removed in a future release.\n");
+ shift->_initialize_body;
+}
+
+
1;
__END__
use base 'Class::MOP::Method::Generated';
+# FIXME refactor into a trait when those are introduced to Class::MOP
+
+sub generate_method_inline {
+ confess "No inline body to generate, " . __PACKAGE__ . " is an abstract base class";
+}
+
+sub _generate_method {
+ confess "No body to generate, " . __PACKAGE__ . " is an abstract base class";
+}
+
+sub is_inline { $_[0]{is_inline} }
+
+sub definition_context { $_[0]{definition_context} }
+
+sub _initialize_body {
+ my $self = shift;
+
+ if ( $self->is_inline ) {
+ return $self->_generate_method_inline;
+ } else {
+ return $self->_generate_method;
+ }
+}
+
sub _expected_method_class { $_[0]{_expected_method_class} }
sub _uninlined_body {
use base 'Class::MOP::Method::Attribute';
-sub _initialize_body {
- my $self = shift;
-
- my $method_name = join "_" => (
- '_generate',
- 'method',
- ($self->is_inline ? 'inline' : ())
- );
-
- $self->{'body'} = $self->$method_name();
-}
-
## generators
-sub generate_method {
- Carp::cluck('The generate_predicate_method method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method;
-}
-
sub _generate_method {
my $attr = (shift)->associated_attribute;
return sub {
## Inline methods
-sub generate_method_inline {
- Carp::cluck('The generate_predicate_method_inline method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_predicate_method_inline;
-}
-
sub _generate_method_inline {
my $self = shift;
my $attr = $self->associated_attribute;
## factory
-sub _initialize_body {
- my $self = shift;
-
- my $method_name = join "_" => (
- '_generate',
- 'method',
- ($self->is_inline ? 'inline' : ())
- );
-
- $self->{'body'} = $self->$method_name();
-}
-
## generators
-sub generate_method {
- Carp::cluck('The generate_reader_method method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method;
-}
-
sub _generate_method {
my $attr = (shift)->associated_attribute;
return sub {
## Inline methods
-sub generate_method_inline {
- Carp::cluck('The generate_reader_method_inline method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method_inline;
-}
-
sub _generate_method_inline {
my $self = shift;
my $attr = $self->associated_attribute;
use base 'Class::MOP::Method::Attribute';
-sub _initialize_body {
- my $self = shift;
-
- my $method_name = join "_" => (
- '_generate',
- 'method',
- ($self->is_inline ? 'inline' : ())
- );
-
- $self->{'body'} = $self->$method_name();
-}
-
## generators
-sub generate_method {
- Carp::cluck('The generate_writer_method method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method;
-}
-
sub _generate_method {
my $attr = (shift)->associated_attribute;
return sub {
## Inline methods
-sub generate_method_inline {
- Carp::cluck('The generate_writer_method_inline method has been made private.'
- . " The public version is deprecated and will be removed in a future release.\n");
- shift->_generate_method_inline;
-}
-
sub _generate_method_inline {
my $self = shift;
my $attr = $self->associated_attribute;