[Catalyst-commits] r13331 - in
Catalyst-Authentication-Store-DBIx-Class/trunk: .
lib/Catalyst/Authentication/Store/DBIx/Class t/lib/TestApp/Schema
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Mon Jun 7 10:19:15 GMT 2010
Author: caelum
Date: 2010-06-07 11:19:15 +0100 (Mon, 07 Jun 2010)
New Revision: 13331
Modified:
Catalyst-Authentication-Store-DBIx-Class/trunk/Changes
Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL
Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
Catalyst-Authentication-Store-DBIx-Class/trunk/t/lib/TestApp/Schema/User.pm
Log:
Support columns with accessors that aren't the column name.
Modified: Catalyst-Authentication-Store-DBIx-Class/trunk/Changes
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/Changes 2010-06-06 03:50:05 UTC (rev 13330)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/Changes 2010-06-07 10:19:15 UTC (rev 13331)
@@ -1,5 +1,7 @@
Revision history for Catalyst-Plugin-Authentication-Store-DBIx-Class
+ Support columns with accessors that aren't the column name.
+
0.1200 2010-04-10
Release 0.1100 as a stable version without further modifications.
Modified: Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL 2010-06-06 03:50:05 UTC (rev 13330)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/Makefile.PL 2010-06-07 10:19:15 UTC (rev 13331)
@@ -1,4 +1,4 @@
-use inc::Module::Install 0.87;
+use inc::Module::Install 0.91;
if( -e 'MANIFEST.SKIP' ) {
system( 'pod2text lib/Catalyst/Authentication/Store/DBIx/Class.pm > README' );
@@ -16,8 +16,10 @@
You have the Catalyst::Plugin::Authentication::Store::DBIx::Class installed.
The module you are installing supercedes it and it's presence has been known
to cause conflicts. We STRONGLY recommend you remove the old module before
-proceeding.
+proceeding.
+You can use CPANPLUS (the cpanp command) to remove the module.
+
You have 5 seconds to abort this install to remove the old module.
EOM
sleep 5;
@@ -30,17 +32,19 @@
perl_version '5.8.1';
-requires ( 'Catalyst::Runtime' => 0,
- 'Catalyst::Plugin::Authentication' => '0.10008',
- 'Catalyst::Model::DBIC::Schema' => 0,
- 'DBIx::Class' => 0,
- 'Catalyst::Model::DBIC::Schema' => '0.18',
- );
+requires (
+ 'Catalyst::Runtime' => '5.80024',
+ 'Catalyst::Plugin::Authentication' => '0.10016',
+ 'Catalyst::Model::DBIC::Schema' => '0.41',
+ 'DBIx::Class' => '0.08122',
+ 'Moose' => '1.07',
+ 'List::MoreUtils' => '0.25',
+);
-
test_requires 'Test::More';
resources repository => 'http://dev.catalystframework.org/repos/Catalyst/Catalyst-Authentication-Store-DBIx-Class';
+auto_install;
+auto_provides;
WriteAll;
-
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-06 03:50:05 UTC (rev 13330)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm 2010-06-07 10:19:15 UTC (rev 13331)
@@ -1,15 +1,16 @@
package Catalyst::Authentication::Store::DBIx::Class::User;
-use strict;
-use warnings;
-use List::MoreUtils qw(all);
-use base qw/Catalyst::Authentication::User/;
-use base qw/Class::Accessor::Fast/;
+use Moose;
+use namespace::autoclean;
+extends 'Catalyst::Authentication::User';
-BEGIN {
- __PACKAGE__->mk_accessors(qw/config resultset _user _roles/);
-}
+use List::MoreUtils 'all';
+has 'config' => (is => 'rw');
+has 'resultset' => (is => 'rw');
+has '_user' => (is => 'rw');
+has '_roles' => (is => 'rw');
+
sub new {
my ( $class, $config, $c) = @_;
@@ -199,6 +200,9 @@
if ($self->_user->can($field)) {
return $self->_user->$field;
+ }
+ elsif (my $accessor = $self->_user->result_source->column_info($field)->{accessor}) {
+ return $self->_user->$accessor;
} else {
return undef;
}
@@ -236,9 +240,15 @@
(my $method) = (our $AUTOLOAD =~ /([^:]+)$/);
return if $method eq "DESTROY";
+ if (my $accessor = $self->_user->result_source->column_info($method)->{accessor}) {
+ $method = $accessor;
+ }
+
$self->_user->$method(@_);
}
+__PACKAGE__->meta->make_immutable(inline_constructor => 0);
+
1;
__END__
Modified: Catalyst-Authentication-Store-DBIx-Class/trunk/t/lib/TestApp/Schema/User.pm
===================================================================
--- Catalyst-Authentication-Store-DBIx-Class/trunk/t/lib/TestApp/Schema/User.pm 2010-06-06 03:50:05 UTC (rev 13330)
+++ Catalyst-Authentication-Store-DBIx-Class/trunk/t/lib/TestApp/Schema/User.pm 2010-06-07 10:19:15 UTC (rev 13331)
@@ -7,7 +7,11 @@
__PACKAGE__->load_components(qw/ Core /);
__PACKAGE__->table( 'user' );
-__PACKAGE__->add_columns( qw/id username email password status role_text session_data/ );
+
+__PACKAGE__->add_columns( qw/id username email status role_text session_data/ );
+
+__PACKAGE__->add_column(password => { accessor => 'password_accessor' });
+
__PACKAGE__->set_primary_key( 'id' );
__PACKAGE__->has_many( 'map_user_role' => 'TestApp::Schema::UserRole' => 'user' );
More information about the Catalyst-commits
mailing list