summaryrefslogtreecommitdiffstats
path: root/lib/MooseX/ABC/Trait/Class.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-05-29 00:05:47 -0500
committerJesse Luehrs <doy@tozt.net>2009-05-29 00:05:47 -0500
commitc94b01a949eadbc8864eac775c526ed8ffeeb98b (patch)
treead5056ea2aaff8418ca2fa2d72c8df6da5bbe7a3 /lib/MooseX/ABC/Trait/Class.pm
parentb4043c557cfe277054e1077124d679aa24bda89c (diff)
downloadmoosex-abc-c94b01a949eadbc8864eac775c526ed8ffeeb98b.tar.gz
moosex-abc-c94b01a949eadbc8864eac775c526ed8ffeeb98b.zip
use better logic in the constructor rather than replacing it manually
Diffstat (limited to 'lib/MooseX/ABC/Trait/Class.pm')
-rw-r--r--lib/MooseX/ABC/Trait/Class.pm18
1 files changed, 3 insertions, 15 deletions
diff --git a/lib/MooseX/ABC/Trait/Class.pm b/lib/MooseX/ABC/Trait/Class.pm
index 0b51a75..6f4bf6c 100644
--- a/lib/MooseX/ABC/Trait/Class.pm
+++ b/lib/MooseX/ABC/Trait/Class.pm
@@ -31,18 +31,6 @@ after _superclasses_updated => sub {
}
}
}
-
- return if $self->has_required_methods;
-
- # at this point, the current class didn't have any required methods to
- # start with, and all of the required methods from superclasses have
- # been satisfied, so restore the constructor
-
- my $constructor = $self->find_method_by_name('new');
- if ($constructor->original_package_name eq 'MooseX::ABC::Role::Object') {
- my $moose_constructor = Class::MOP::class_of('Moose::Object')->get_method('new');
- $self->add_method(new => $moose_constructor->clone);
- }
};
around _immutable_options => sub {
@@ -50,11 +38,11 @@ around _immutable_options => sub {
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;
+ if ($self->has_required_methods) {
+ push @options, inline_constructor => 0;
}
elsif ($constructor->original_package_name eq 'MooseX::ABC::Role::Object') {
- push @options, inline_constructor => 0;
+ push @options, replace_constructor => 1;
}
return @options;
};