Kill off Class::Accessor::Fast
Tomas Doran [Sat, 30 Jun 2012 10:50:22 +0000 (11:50 +0100)]
Changes
Makefile.PL
lib/Catalyst/Authentication/Credential/Password.pm
lib/Catalyst/Authentication/Credential/Remote.pm
lib/Catalyst/Authentication/Realm.pm
lib/Catalyst/Authentication/Store/Minimal.pm
lib/Catalyst/Authentication/Store/Null.pm
lib/Catalyst/Authentication/User.pm

diff --git a/Changes b/Changes
index a8b09a0..dd26cf8 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 Revision history for Perl extension Catalyst::Plugin::Authentication
 
+    - Change all classes to Moose and MooseX::Emulate::Class::Accessor::Fast,
+      fixing undeclared dependency on Class::Accessor::Fast.
     - Change Catalyst::Authentication::Realm to use String::RewritePrefix
       rather than doing namespace mangling manually.
     - Fix whitespace and tabs, add Test::EOL and Test::NoTabs
index 865a31c..0d29ef6 100644 (file)
@@ -22,7 +22,7 @@ requires 'MRO::Compat';
 requires 'Catalyst::Plugin::Session' => '0.10';
 requires 'Moose';
 requires 'MooseX::Emulate::Class::Accessor::Fast';
-requires 'namespace::clean';
+requires 'namespace::autoclean';
 requires 'String::RewritePrefix';
 requires 'Try::Tiny';
 
index 444318b..0ce16c7 100644 (file)
@@ -1,9 +1,8 @@
 package Catalyst::Authentication::Credential::Password;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-
-use base qw/Class::Accessor::Fast/;
+with 'MooseX::Emulate::Class::Accessor::Fast';
 
 use Scalar::Util        ();
 use Catalyst::Exception ();
index e7bfb56..74e39ac 100644 (file)
@@ -1,15 +1,13 @@
 package Catalyst::Authentication::Credential::Remote;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-use Try::Tiny qw/ try catch /;
+with 'MooseX::Emulate::Class::Accessor::Fast';
 
-use base 'Class::Accessor::Fast';
+use Try::Tiny qw/ try catch /;
 
-BEGIN {
-    __PACKAGE__->mk_accessors(
-        qw/allow_re deny_re cutname_re source realm username_field/);
-}
+__PACKAGE__->mk_accessors(
+    qw/allow_re deny_re cutname_re source realm username_field/);
 
 sub new {
     my ( $class, $config, $app, $realm ) = @_;
index c469f88..2205dd0 100644 (file)
@@ -1,15 +1,12 @@
 package Catalyst::Authentication::Realm;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
+with 'MooseX::Emulate::Class::Accessor::Fast';
 use String::RewritePrefix;
 use Try::Tiny qw/ try catch /;
 
-use base qw/Class::Accessor::Fast/;
-
-BEGIN {
-    __PACKAGE__->mk_accessors(qw/store credential name config/);
-};
+__PACKAGE__->mk_accessors(qw/store credential name config/);
 
 ## Add use_session config item to realm.
 
index 63a0afd..921f8c4 100644 (file)
@@ -1,14 +1,11 @@
 package Catalyst::Authentication::Store::Minimal;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-
+with 'MooseX::Emulate::Class::Accessor::Fast';
 use Scalar::Util qw( blessed );
-use base qw/Class::Accessor::Fast/;
 
-BEGIN {
-    __PACKAGE__->mk_accessors(qw/userhash userclass/);
-}
+__PACKAGE__->mk_accessors(qw/userhash userclass/);
 
 sub new {
     my ( $class, $config, $app, $realm) = @_;
index 2664685..26fef14 100644 (file)
@@ -1,15 +1,12 @@
 package Catalyst::Authentication::Store::Null;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
+with 'MooseX::Emulate::Class::Accessor::Fast';
 
 use Catalyst::Authentication::User::Hash;
 
-use base qw( Class::Accessor::Fast );
-
-BEGIN {
-    __PACKAGE__->mk_accessors( qw( _config ) );
-}
+__PACKAGE__->mk_accessors( qw( _config ) );
 
 sub new {
     my ( $class, $config, $app, $realm ) = @_;
index d570459..efc029a 100644 (file)
@@ -1,21 +1,21 @@
 package Catalyst::Authentication::User;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-use base qw/Class::Accessor::Fast/;
+with 'MooseX::Emulate::Class::Accessor::Fast';
 use Scalar::Util qw/refaddr/;
 
-## auth_realm is the realm this user came from. 
+## auth_realm is the realm this user came from.
 __PACKAGE__->mk_accessors(qw/auth_realm store/);
 
-## THIS IS NOT A COMPLETE CLASS! it is intended to provide base functionality only.  
+## THIS IS NOT A COMPLETE CLASS! it is intended to provide base functionality only.
 ## translation - it won't work if you try to use it directly.
 
 ## chances are you want to override this.
 sub id { shift->get('id'); }
 
-## this relies on 'supported_features' being implemented by the subclass.. 
-## but it is not an error if it is not.  it just means you support nothing.  
+## this relies on 'supported_features' being implemented by the subclass..
+## but it is not an error if it is not.  it just means you support nothing.
 ## nihilist user objects are welcome here.
 sub supports {
     my ( $self, @spec ) = @_;
@@ -31,7 +31,7 @@ sub supports {
 
             $cursor = $cursor->{$_};
         }
-    } 
+    }
 
     return $cursor;
 }
@@ -54,7 +54,7 @@ sub get {
 }
 
 ## REQUIRED.
-## get_object should return the underlying user object.  This is for when more advanced uses of the 
+## get_object should return the underlying user object.  This is for when more advanced uses of the
 ## user is required.  Modifications to the existing user, etc.  Changes in the object returned
 ## by this routine may not be reflected in the C::P::A::User object - if this is required, re-authenticating
 ## the user is probably the best route to take.
@@ -63,7 +63,7 @@ sub get_object {
     return shift;
 }
 
-## obj is shorthand for get_object.  This is originally from the DBIx::Class store, but 
+## obj is shorthand for get_object.  This is originally from the DBIx::Class store, but
 ## as it has become common usage, this makes things more compatible.  Plus, it's shorter.
 sub obj {
     my $self = shift;