From 389af2567e27b586b4c6f610c0da0112d56d1be7 Mon Sep 17 00:00:00 2001 From: Iain C Docherty Date: Sun, 17 Mar 2013 12:38:43 -0400 Subject: [PATCH] Fixed errors with Building Roles --- lib/Lacuna/Role/Building/CantBuildWithoutPlan.pm | 8 +++++--- lib/Lacuna/Role/Building/UpgradeWithHalls.pm | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) 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? -- 2.51.2