diff --git a/lib/Lacuna/Role/Building/CantBuildWithoutPlan.pm b/lib/Lacuna/Role/Building/CantBuildWithoutPlan.pm index 2a30e657..9e977240 100644 --- a/lib/Lacuna/Role/Building/CantBuildWithoutPlan.pm +++ b/lib/Lacuna/Role/Building/CantBuildWithoutPlan.pm @@ -3,9 +3,11 @@ package Lacuna::Role::Building::CantBuildWithoutPlan; use Moose::Role; around can_build => sub { - my ($orig, $self, $body) = @_; - if ($body->get_plan(__PACKAGE__, 1)) { - return $orig->($self, $body); + my $orig = shift; + my $self = shift; + + if ($self->body->get_plan(ref $self, 1)) { + return $self->$orig(@_); } confess [1013,"You can't build ".$self->name.", unless you have a plan."]; }; diff --git a/lib/Lacuna/Role/Building/UpgradeWithHalls.pm b/lib/Lacuna/Role/Building/UpgradeWithHalls.pm index 3431ac43..141d6f49 100644 --- a/lib/Lacuna/Role/Building/UpgradeWithHalls.pm +++ b/lib/Lacuna/Role/Building/UpgradeWithHalls.pm @@ -9,8 +9,8 @@ around can_upgrade => sub { my $self = shift; my $body = $self->body; - if ($body->get_plan(__PACKAGE__, $self->level + 1)) { - return $orig->$self(@_); + if ($body->get_plan(ref $self, $self->level + 1)) { + return $self->$orig(@_); } # Do we have enough hall (plans) to upgrade?