use Scalar::Util 'blessed';
use Carp 'confess';
+use Sub::Name 'subname';
use Moose::Meta::Class;
use Moose::Meta::Attribute;
else {
$meta = Moose::Meta::Class->initialize($pkg => (
':attribute_metaclass' => 'Moose::Meta::Attribute'
- ));
+ ));
}
+ # NOTE:
+ # &alias_method will install the method, but it
+ # will not name it with
+
+ # handle superclasses
+ $meta->alias_method('extends' => subname 'Moose::extends' => sub { $meta->superclasses(@_) });
+
# handle attributes
- $meta->alias_method('has' => sub { $meta->add_attribute(@_) });
+ $meta->alias_method('has' => subname 'Moose::has' => sub { $meta->add_attribute(@_) });
# handle method modifers
- $meta->alias_method('before' => sub {
+ $meta->alias_method('before' => subname 'Moose::before' => sub {
my $code = pop @_;
$meta->add_before_method_modifier($_, $code) for @_;
});
- $meta->alias_method('after' => sub {
+ $meta->alias_method('after' => subname 'Moose::after' => sub {
my $code = pop @_;
$meta->add_after_method_modifier($_, $code) for @_;
});
- $meta->alias_method('around' => sub {
+ $meta->alias_method('around' => subname 'Moose::around' => sub {
my $code = pop @_;
$meta->add_around_method_modifier($_, $code) for @_;
});
=head1 SYNOPSIS
package Point;
+ use strict;
+ use warnings;
use Moose;
has '$.x' => (reader => 'x');
}
package Point3D;
+ use strict;
+ use warnings;
use Moose;
- use base 'Point';
+ extends 'Point';
has '$:z';