[Catalyst-commits] r13337 - Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Fri Jun 11 00:10:03 GMT 2010


Author: caelum
Date: 2010-06-11 01:10:03 +0100 (Fri, 11 Jun 2010)
New Revision: 13337

Modified:
   Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
Log:
support setting columns from AUTOLOAD too

Modified: Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2010-06-10 09:54:11 UTC (rev 13336)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2010-06-11 00:10:03 UTC (rev 13337)
@@ -243,7 +243,16 @@
     (my $method) = (our $AUTOLOAD =~ /([^:]+)$/);
     return if $method eq "DESTROY";
 
-    return $self->get($method);
+    if (my $code = $self->_user->can($method)) {
+        return $self->_user->$code(@_);
+    }
+    elsif (my $accessor =
+         try { $self->_user->result_source->column_info($method)->{accessor} }) {
+        return $self->_user->$accessor(@_);
+    } else {
+        # XXX this should also throw
+        return undef;
+    }
 }
 
 __PACKAGE__->meta->make_immutable(inline_constructor => 0);




More information about the Catalyst-commits mailing list