[Catalyst-commits] r13333 - in Catalyst-Authentication-Store-DBIx-Class/trunk: . lib/Catalyst/Authentication/Store/DBIx/Class

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Mon Jun 7 10:54:01 GMT 2010


Author: caelum
Date: 2010-06-07 11:54:01 +0100 (Mon, 07 Jun 2010)
New Revision: 13333

Modified:
   Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL
   Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
Log:
add namespace::autoclean dep, fix AUTOLOAD to try method first, then column accessor

Modified: Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL	2010-06-07 10:33:47 UTC (rev 13332)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL	2010-06-07 10:54:01 UTC (rev 13333)
@@ -38,6 +38,7 @@
     'Catalyst::Model::DBIC::Schema'     => '0.18',
     'DBIx::Class'                       => '0.08',
     'Moose'                             => 0,
+    'namespace::autoclean'              => 0,
     'List::MoreUtils'                   => 0,
 );
 

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-07 10:33:47 UTC (rev 13332)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2010-06-07 10:54:01 UTC (rev 13333)
@@ -198,8 +198,8 @@
 sub get {
     my ($self, $field) = @_;
 
-    if ($self->_user->can($field)) {
-        return $self->_user->$field;
+    if (my $code = $self->_user->can($field)) {
+        return $self->_user->$code;
     }
     elsif (my $accessor = $self->_user->result_source->column_info($field)->{accessor}) {
         return $self->_user->$accessor;
@@ -240,11 +240,12 @@
     (my $method) = (our $AUTOLOAD =~ /([^:]+)$/);
     return if $method eq "DESTROY";
 
-    if (my $accessor = $self->_user->result_source->column_info($method)->{accessor}) {
-        $method = $accessor;
+    if (my $code = $self->_user->can($method)) {
+        $self->_user->$code(@_);
     }
-
-    $self->_user->$method(@_);
+    elsif (my $accessor = $self->_user->result_source->column_info($method)->{accessor}) {
+        $self->_user->$accessor(@_);
+    }
 }
 
 __PACKAGE__->meta->make_immutable(inline_constructor => 0);




More information about the Catalyst-commits mailing list