[Catalyst-commits] r13334 - 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 12:38:01 GMT 2010
Author: caelum
Date: 2010-06-07 13:38:01 +0100 (Mon, 07 Jun 2010)
New Revision: 13334
Modified:
Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL
Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
Log:
cleanup and handle unknown column/method
Modified: Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL 2010-06-07 10:54:01 UTC (rev 13333)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL 2010-06-07 12:38:01 UTC (rev 13334)
@@ -40,6 +40,7 @@
'Moose' => 0,
'namespace::autoclean' => 0,
'List::MoreUtils' => 0,
+ 'Try::Tiny' => 0,
);
test_requires 'Test::More';
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:54:01 UTC (rev 13333)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm 2010-06-07 12:38:01 UTC (rev 13334)
@@ -5,6 +5,7 @@
extends 'Catalyst::Authentication::User';
use List::MoreUtils 'all';
+use Try::Tiny;
has 'config' => (is => 'rw');
has 'resultset' => (is => 'rw');
@@ -201,9 +202,11 @@
if (my $code = $self->_user->can($field)) {
return $self->_user->$code;
}
- elsif (my $accessor = $self->_user->result_source->column_info($field)->{accessor}) {
+ elsif (my $accessor =
+ try { $self->_user->result_source->column_info($field)->{accessor} }) {
return $self->_user->$accessor;
} else {
+ # XXX this should probably throw
return undef;
}
}
@@ -240,12 +243,7 @@
(my $method) = (our $AUTOLOAD =~ /([^:]+)$/);
return if $method eq "DESTROY";
- if (my $code = $self->_user->can($method)) {
- $self->_user->$code(@_);
- }
- elsif (my $accessor = $self->_user->result_source->column_info($method)->{accessor}) {
- $self->_user->$accessor(@_);
- }
+ return $self->get($method);
}
__PACKAGE__->meta->make_immutable(inline_constructor => 0);
More information about the Catalyst-commits
mailing list