Use 'isa' checks for attribute validation
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Role / Error.pm
index 4478376..5be21cd 100644 (file)
@@ -6,8 +6,16 @@ has error => (is => 'rw', 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"} };
+        return $$errref unless @_;
+        $$errref = $_[0];
+        return undef;
+    }
+
     return $self->$orig unless @_;
-    $self->$orig(ref($_[0]) ? $_[0] : join('', @_));
+    $self->$orig(@_);
     return undef;
 };