diff options
author | doy <doy@tozt.net> | 2009-04-20 20:37:45 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-04-20 20:37:45 -0500 |
commit | 32bffd60145840cd207495ab2750a9aeca73f42d (patch) | |
tree | 915c2fdcc55a9825e8bf24f53c9fcbfc56ffdada /lib | |
parent | 2defb71732b88e06c3fb61731cccf0a7401b1145 (diff) | |
download | moosex-nonmoose-32bffd60145840cd207495ab2750a9aeca73f42d.tar.gz moosex-nonmoose-32bffd60145840cd207495ab2750a9aeca73f42d.zip |
fix _immutable_options wrapper
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MooseX/NonMoose/Meta/Role/Class.pm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/MooseX/NonMoose/Meta/Role/Class.pm b/lib/MooseX/NonMoose/Meta/Role/Class.pm index 816b319..6e5c6e0 100644 --- a/lib/MooseX/NonMoose/Meta/Role/Class.pm +++ b/lib/MooseX/NonMoose/Meta/Role/Class.pm @@ -11,27 +11,29 @@ around _immutable_options => sub { my $orig = shift; my $self = shift; + my @options = $self->$orig(@_); + # do nothing if extends was never called - return $self->$orig(@_) if !$self->has_nonmoose_constructor; + return @options if !$self->has_nonmoose_constructor; # if we're using just the metaclass trait, but not the constructor trait, # then suppress the warning about not inlining a constructor - return $self->$orig(inline_constructor => 0, @_) + return (inline_constructor => 0, @options) unless Class::MOP::class_of($self->constructor_class)->does_role('MooseX::NonMoose::Meta::Role::Constructor'); # do nothing if extends was called, but we then added a method modifier to # the constructor (this will warn, but that's okay) - return $self->$orig(@_) + return @options if $self->get_method('new')->isa('Class::MOP::Method::Wrapped'); # do nothing if we explicitly ask for the constructor to not be inlined - my %args = @_; - return $self->$orig(@_) if !$args{inline_constructor}; + my %options = @options; + return @options if !$options{inline_constructor}; # otherwise, explicitly ask for the constructor to be replaced (to suppress # the warning message), since this is the expected usage, and shouldn't # cause a warning - return $self->$orig(replace_constructor => 1, @_); + return (replace_constructor => 1, @options); }; around superclasses => sub { |