Revision history for Perl extension Moose
0.45
+ * Moose
+ - Because of work in Class::MOP 0.56, all
+ XS based functionality is now optional
+ and a Pure Perl version is supplied
+ - the CLASS_MOP_NO_XS environment variable
+ can now be used to force non-XS versions
+ to always be used
+ - several of the packages have been tweaked
+ to take care of this, mostly we added
+ support for the package_name and name
+ variables in all the Method metaclasses
+
* Moose::Meta::Class
- added same 'add_package_symbol' fix as in
Class::MOP 0.56
requires 'Scalar::Util' => $win32 ? '1.17' : '1.18';
requires 'Carp';
requires 'Class::MOP' => '0.56';
-requires 'Sub::Name' => '0.02';
requires 'Sub::Exporter' => '0.972';
# only used by oose.pm, not Moose.pm :P
Class::MOP
Scalar::Util
Carp
- Sub::Name
Sub::Exporter
B
use Scalar::Util 'blessed', 'reftype';
use Carp 'confess', 'croak', 'cluck';
-use Sub::Name 'subname';
use Sub::Exporter;
use MRO::Compat;
-use Class::MOP;
+use Class::MOP 0.56;
use Moose::Meta::Class;
use Moose::Meta::TypeConstraint;
my %exports = (
extends => sub {
my $class = $CALLER;
- return subname 'Moose::extends' => sub (@) {
+ return Class::MOP::subname('Moose::extends' => sub (@) {
confess "Must derive at least one class" unless @_;
my @supers = @_;
# of sync when the classes are being built
my $meta = $class->meta->_fix_metaclass_incompatability(@supers);
$meta->superclasses(@supers);
- };
+ });
},
with => sub {
my $class = $CALLER;
- return subname 'Moose::with' => sub (@) {
+ return Class::MOP::subname('Moose::with' => sub (@) {
Moose::Util::apply_all_roles($class->meta, @_)
- };
+ });
},
has => sub {
my $class = $CALLER;
- return subname 'Moose::has' => sub ($;%) {
+ return Class::MOP::subname('Moose::has' => sub ($;%) {
my $name = shift;
croak 'Usage: has \'name\' => ( key => value, ... )' if @_ == 1;
my %options = @_;
my $attrs = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
$class->meta->add_attribute( $_, %options ) for @$attrs;
- };
+ });
},
before => sub {
my $class = $CALLER;
- return subname 'Moose::before' => sub (@&) {
+ return Class::MOP::subname('Moose::before' => sub (@&) {
my $code = pop @_;
my $meta = $class->meta;
$meta->add_before_method_modifier( $_, $code ) for @_;
- };
+ });
},
after => sub {
my $class = $CALLER;
- return subname 'Moose::after' => sub (@&) {
+ return Class::MOP::subname('Moose::after' => sub (@&) {
my $code = pop @_;
my $meta = $class->meta;
$meta->add_after_method_modifier( $_, $code ) for @_;
- };
+ });
},
around => sub {
my $class = $CALLER;
- return subname 'Moose::around' => sub (@&) {
+ return Class::MOP::subname('Moose::around' => sub (@&) {
my $code = pop @_;
my $meta = $class->meta;
$meta->add_around_method_modifier( $_, $code ) for @_;
- };
+ });
},
super => sub {
# FIXME can be made into goto, might break caller() for existing code
- return subname 'Moose::super' => sub { return unless our $SUPER_BODY; $SUPER_BODY->(our @SUPER_ARGS) }
+ return Class::MOP::subname('Moose::super' => sub { return unless our $SUPER_BODY; $SUPER_BODY->(our @SUPER_ARGS) })
},
#next => sub {
# return subname 'Moose::next' => sub { @_ = our @SUPER_ARGS; goto \&next::method };
#},
override => sub {
my $class = $CALLER;
- return subname 'Moose::override' => sub ($&) {
+ return Class::MOP::subname('Moose::override' => sub ($&) {
my ( $name, $method ) = @_;
$class->meta->add_override_method_modifier( $name => $method );
- };
+ });
},
inner => sub {
- return subname 'Moose::inner' => sub {
+ return Class::MOP::subname('Moose::inner' => sub {
my $pkg = caller();
our ( %INNER_BODY, %INNER_ARGS );
} else {
return;
}
- };
+ });
},
augment => sub {
my $class = $CALLER;
- return subname 'Moose::augment' => sub (@&) {
+ return Class::MOP::subname('Moose::augment' => sub (@&) {
my ( $name, $method ) = @_;
$class->meta->add_augment_method_modifier( $name => $method );
- };
+ });
},
make_immutable => sub {
my $class = $CALLER;
- return subname 'Moose::make_immutable' => sub {
+ return Class::MOP::subname('Moose::make_immutable' => sub {
cluck "The make_immutable keyword has been deprecated, " .
"please go back to __PACKAGE__->meta->make_immutable\n";
$class->meta->make_immutable(@_);
- };
+ });
},
confess => sub {
return \&Carp::confess;
# make sure it is from Moose
my ($pkg_name) = Class::MOP::get_code_info($keyword);
- next if $@;
next if $pkg_name ne 'Moose';
# and if it is from Moose then undef the slot
use Scalar::Util 'blessed', 'weaken', 'reftype';
use Carp 'confess';
-use Sub::Name 'subname';
use overload ();
-our $VERSION = '0.23';
+our $VERSION = '0.24';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Meta::Method::Accessor;
next if $class_name->isa("Moose::Object") and $handle =~ /^BUILD|DEMOLISH$/ || Moose::Object->can($handle);
if ((reftype($method_to_call) || '') eq 'CODE') {
- $associated_class->add_method($handle => subname $name, $method_to_call);
+ $associated_class->add_method($handle => Class::MOP::subname($name, $method_to_call));
}
else {
# NOTE:
# delegation being actually represented
# in the stack trace.
# - SL
- $associated_class->add_method($handle => subname $name, sub {
+ $associated_class->add_method($handle => Class::MOP::subname($name, sub {
my $proxy = (shift)->$accessor();
(defined $proxy)
|| confess "Cannot delegate $handle to $method_to_call because " .
"the value of " . $self->name . " is not defined";
$proxy->$method_to_call(@_);
- });
+ }));
}
}
}
use strict;
use warnings;
-use Class::MOP;
+use Class::MOP 0.56;
use Carp 'confess';
use Scalar::Util 'weaken', 'blessed', 'reftype';
-our $VERSION = '0.22';
+our $VERSION = '0.23';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Meta::Method::Overriden;
#next unless $self->does_role($role);
}
else {
- next if ($pkg || '') ne $class_name &&
- ($name || '') ne '__ANON__';
+ next if ($pkg || '') ne $class_name ||
+ (($name || '') ne '__ANON__' && ($pkg || '') ne $class_name);
}
- $map->{$symbol} = $method_metaclass->wrap($code);
+ $map->{$symbol} = $method_metaclass->wrap(
+ $code,
+ package_name => $class_name,
+ name => $symbol
+ );
}
return $map;
use strict;
use warnings;
-our $VERSION = '0.01';
+use Carp 'confess';
+
+our $VERSION = '0.02';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Method';
-use Sub::Name;
-
-use Carp qw(confess);
-
sub new {
my ( $class, %args ) = @_;
};
# FIXME store additional attrs
- $class->wrap($body);
+ $class->wrap(
+ $body,
+ package_name => $meta->name,
+ name => $name
+ );
}
1;
use Carp 'confess';
use Scalar::Util 'blessed', 'weaken', 'looks_like_number';
-our $VERSION = '0.10';
+our $VERSION = '0.11';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Method',
(exists $options{options} && ref $options{options} eq 'HASH')
|| confess "You must pass a hash of options";
+ ($options{package_name} && $options{name})
+ || confess "You must supply the package_name and name parameters";
+
my $self = bless {
# from our superclass
- '&!body' => undef,
+ '&!body' => undef,
+ '$!package_name' => $options{package_name},
+ '$!name' => $options{name},
# specific to this subclass
'%!options' => $options{options},
'$!meta_instance' => $options{metaclass}->get_meta_instance,
use Carp 'confess';
use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.02';
+our $VERSION = '0.03';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Method',
(exists $options{options} && ref $options{options} eq 'HASH')
|| confess "You must pass a hash of options";
+
+ ($options{package_name} && $options{name})
+ || confess "You must supply the package_name and name parameters";
my $self = bless {
# from our superclass
- '&!body' => undef,
+ '&!body' => undef,
+ '$!package_name' => $options{package_name},
+ '$!name' => $options{name},
# ...
'%!options' => $options{options},
'$!associated_metaclass' => $options{metaclass},
use strict;
use warnings;
-our $VERSION = '0.01';
+use Carp 'confess';
+
+our $VERSION = '0.02';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Method';
-use Sub::Name;
-
-use Carp qw(confess);
-
sub new {
my ( $class, %args ) = @_;
# subname "${_super_package}::${name}", $method;
# FIXME store additional attrs
- $class->wrap($body);
+ $class->wrap(
+ $body,
+ package_name => $args{class}->name,
+ name => $name
+ );
}
1;
use warnings;
use metaclass;
-use Sub::Name 'subname';
use Carp 'confess';
use Scalar::Util 'blessed', 'reftype';
-our $VERSION = '0.12';
+our $VERSION = '0.13';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Meta::Class;
next unless $self->does_role($role);
}
else {
- next if ($pkg || '') ne $role_name &&
- ($name || '') ne '__ANON__';
+ next if ($pkg || '') ne $role_name ||
+ (($name || '') ne '__ANON__' && ($pkg || '') ne $role_name);
}
- $map->{$symbol} = $method_metaclass->wrap($code);
+ $map->{$symbol} = $method_metaclass->wrap(
+ $code,
+ package_name => $role_name,
+ name => $name
+ );
}
return $map;
use Carp 'confess';
use Scalar::Util 'blessed', 'reftype';
-our $VERSION = '0.01';
+our $VERSION = '0.02';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Role';
# make sure to bless the
# method if nessecary
- $method = $self->method_metaclass->wrap($method)
- if !blessed($method);
+ $method = $self->method_metaclass->wrap(
+ $method,
+ package_name => $self->name,
+ name => $method_name
+ ) if !blessed($method);
$self->get_method_map->{$method_name} = $method;
}
use overload '""' => sub { shift->name }, # stringify to tc name
fallback => 1;
-use Sub::Name 'subname';
use Carp 'confess';
use Scalar::Util qw(blessed refaddr);
-our $VERSION = '0.12';
+our $VERSION = '0.13';
our $AUTHORITY = 'cpan:STEVAN';
__PACKAGE__->meta->add_attribute('name' => (reader => 'name'));
# then we compile them to run without
# having to recurse as we did before
- return subname $self->name => sub {
+ return Class::MOP::subname($self->name => sub {
local $_ = $_[0];
foreach my $parent (@parents) {
return undef unless $parent->($_[0]);
}
return undef unless $check->($_[0]);
1;
- };
+ });
}
sub _compile_type {
my ($self, $check) = @_;
- return subname $self->name => sub {
+ return Class::MOP::subname($self->name => sub {
local $_ = $_[0];
return undef unless $check->($_[0]);
1;
- };
+ });
}
## other utils ...
use Scalar::Util 'blessed';
use Carp 'confess';
-use Sub::Name 'subname';
use Data::OptList;
use Sub::Exporter;
-our $VERSION = '0.08';
+our $VERSION = '0.09';
our $AUTHORITY = 'cpan:STEVAN';
use Moose ();
my %exports = (
extends => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::extends' => sub {
+ return Class::MOP::subname('Moose::Role::extends' => sub {
confess "Moose::Role does not currently support 'extends'"
- };
+ });
},
with => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::with' => sub (@) {
+ return Class::MOP::subname('Moose::Role::with' => sub (@) {
Moose::Util::apply_all_roles($meta, @_)
- };
+ });
},
requires => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::requires' => sub (@) {
+ return Class::MOP::subname('Moose::Role::requires' => sub (@) {
confess "Must specify at least one method" unless @_;
$meta->add_required_methods(@_);
- };
+ });
},
excludes => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::excludes' => sub (@) {
+ return Class::MOP::subname('Moose::Role::excludes' => sub (@) {
confess "Must specify at least one role" unless @_;
$meta->add_excluded_roles(@_);
- };
+ });
},
has => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::has' => sub ($;%) {
+ return Class::MOP::subname('Moose::Role::has' => sub ($;%) {
my ($name, %options) = @_;
$meta->add_attribute($name, %options)
- };
+ });
},
before => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::before' => sub (@&) {
+ return Class::MOP::subname('Moose::Role::before' => sub (@&) {
my $code = pop @_;
$meta->add_before_method_modifier($_, $code) for @_;
- };
+ });
},
after => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::after' => sub (@&) {
+ return Class::MOP::subname('Moose::Role::after' => sub (@&) {
my $code = pop @_;
$meta->add_after_method_modifier($_, $code) for @_;
- };
+ });
},
around => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::around' => sub (@&) {
+ return Class::MOP::subname('Moose::Role::around' => sub (@&) {
my $code = pop @_;
$meta->add_around_method_modifier($_, $code) for @_;
- };
+ });
},
# see Moose.pm for discussion
super => sub {
- return subname 'Moose::Role::super' => sub { return unless $Moose::SUPER_BODY; $Moose::SUPER_BODY->(@Moose::SUPER_ARGS) }
+ return Class::MOP::subname('Moose::Role::super' => sub { return unless $Moose::SUPER_BODY; $Moose::SUPER_BODY->(@Moose::SUPER_ARGS) })
},
#next => sub {
# return subname 'Moose::Role::next' => sub { @_ = @Moose::SUPER_ARGS; goto \&next::method };
#},
override => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::override' => sub ($&) {
+ return Class::MOP::subname('Moose::Role::override' => sub ($&) {
my ($name, $code) = @_;
$meta->add_override_method_modifier($name, $code);
- };
+ });
},
inner => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::inner' => sub {
+ return Class::MOP::subname('Moose::Role::inner' => sub {
confess "Moose::Role cannot support 'inner'";
- };
+ });
},
augment => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::augment' => sub {
+ return Class::MOP::subname('Moose::Role::augment' => sub {
confess "Moose::Role cannot support 'augment'";
- };
+ });
},
confess => sub {
return \&Carp::confess;
use Sub::Exporter;
use Scalar::Util 'blessed';
use Carp 'confess';
-use Class::MOP ();
+use Class::MOP 0.56;
-our $VERSION = '0.05';
+our $VERSION = '0.06';
our $AUTHORITY = 'cpan:STEVAN';
my @exports = qw[
use strict;
use warnings;
-use Class::MOP;
+use Class::MOP 0.56;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
BEGIN {