[Catalyst-commits] r9589 - trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication

jayk at dev.catalyst.perl.org jayk at dev.catalyst.perl.org
Sat Mar 28 01:43:47 GMT 2009


Author: jayk
Date: 2009-03-28 01:43:46 +0000 (Sat, 28 Mar 2009)
New Revision: 9589

Modified:
   trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
   trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User.pm
Log:
Add obj() as shorthand method for get_object()
Remove warning about storage if an alternate realm is being used.

Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm	2009-03-27 14:41:25 UTC (rev 9588)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm	2009-03-28 01:43:46 UTC (rev 9589)
@@ -29,8 +29,9 @@
 
     $app->log->debug("Setting up auth realm $realmname") if $app->debug;
 
-    # use the Null store as a default
-    if( ! exists $config->{store}{class} ) {
+    # use the Null store as a default - Don't complain if the realm class is being overridden, 
+    # as the new realm may behave differently.
+    if( ! exists($config->{store}{class}) && ! exists($config->{class}) ) {
         $config->{store}{class} = '+Catalyst::Authentication::Store::Null';
         $app->log->debug( qq(No Store specified for realm "$realmname", using the Null store.) );
     } 

Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User.pm	2009-03-27 14:41:25 UTC (rev 9588)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User.pm	2009-03-28 01:43:46 UTC (rev 9589)
@@ -64,6 +64,13 @@
     return shift;
 }
 
+## 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;
+    return $self->get_object(@_);
+}
+
 ## Backwards Compatibility
 ## you probably want auth_realm, in fact.  but this does work for backwards compatibility.
 ## store should be a read-write accessor - so it was moved to mk_accessors
@@ -106,9 +113,18 @@
 
 An introspection method used to determine what features a user object has, to support credential and authorization plugins.
 
-=head2 get( )
+=head2 get( $field )
 
+Returns the value for the $field provided.
+
 =head2 get_object( )
 
+Returns the underlying object storing the user data.  The return value of this function will vary depending
+on the storage module used.
+
+=head2 obj( )
+
+Shorthand for get_object( )
+
 =cut
 




More information about the Catalyst-commits mailing list