From: Dagfinn Ilmari Mannsåker Date: Tue, 14 Aug 2012 11:47:49 +0000 (+0200) Subject: Make SQLT::Role::Error internals closer to Class::Base X-Git-Tag: v0.11013_01~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d24c55feeda111e0acdb1cc7ea7723099d9c8150;p=dbsrgits%2FSQL-Translator.git Make SQLT::Role::Error internals closer to Class::Base --- diff --git a/lib/SQL/Translator/Role/Error.pm b/lib/SQL/Translator/Role/Error.pm index f8aab10..40319e4 100644 --- a/lib/SQL/Translator/Role/Error.pm +++ b/lib/SQL/Translator/Role/Error.pm @@ -1,14 +1,19 @@ package SQL::Translator::Role::Error; use Moo::Role; -has error => (is => 'rw', default => sub { '' }); +has _ERROR => ( + is => 'rw', + accessor => 'error', + init_arg => undef, + default => sub { '' }, +); around error => sub { my ($orig, $self) = (shift, shift); # Emulate horrible Class::Base API - unless (ref ($self)) { - my $errref = do { no strict 'refs'; \${"${self}::_ERROR"} }; + unless (ref($self)) { + my $errref = do { no strict 'refs'; \${"${self}::ERROR"} }; return $$errref unless @_; $$errref = $_[0]; return undef;