diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-05-28 23:33:25 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-05-28 23:33:25 -0500 |
commit | 9a3bb554e8e0c4848212dce8a2cfdf324b2c2229 (patch) | |
tree | ed9fec668ff552b3b8de4e1396e02dc2ac8ced66 | |
parent | 3380df6862fe07ccaf17c7ba30616167bb6e880d (diff) | |
download | moosex-abc-9a3bb554e8e0c4848212dce8a2cfdf324b2c2229.tar.gz moosex-abc-9a3bb554e8e0c4848212dce8a2cfdf324b2c2229.zip |
wrap _immutable_options to silence some warnings
-rw-r--r-- | lib/MooseX/ABC/Trait/Class.pm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/MooseX/ABC/Trait/Class.pm b/lib/MooseX/ABC/Trait/Class.pm index b47bea0..0b51a75 100644 --- a/lib/MooseX/ABC/Trait/Class.pm +++ b/lib/MooseX/ABC/Trait/Class.pm @@ -45,6 +45,20 @@ after _superclasses_updated => sub { } }; +around _immutable_options => sub { + my $orig = shift; + my $self = shift; + my @options = $self->$orig(@_); + my $constructor = $self->find_method_by_name('new'); + if ($constructor->original_package_name eq 'Moose::Object') { + push @options, replace_constructor => 1; + } + elsif ($constructor->original_package_name eq 'MooseX::ABC::Role::Object') { + push @options, inline_constructor => 0; + } + return @options; +}; + no Moose::Role; 1; |