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

jayk at dev.catalyst.perl.org jayk at dev.catalyst.perl.org
Wed Jan 28 05:01:57 GMT 2009


Author: jayk
Date: 2009-01-28 05:01:57 +0000 (Wed, 28 Jan 2009)
New Revision: 9130

Modified:
   trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
Log:
tweak progressive realm documentation and add check to error on 
non-file-missing failures related to store/credential loading


Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm	2009-01-27 23:26:12 UTC (rev 9129)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm	2009-01-28 05:01:57 UTC (rev 9130)
@@ -71,12 +71,18 @@
     };
     
     if ($@) {
+        # If the file is missing, then try the old-style fallback, 
+        # but re-throw anything else for the user to deal with.
+        die unless $@ =~ /^Can't locate/;
         $app->log->warn( qq(Credential class "$credentialclass" not found, trying deprecated ::Plugin:: style naming. ) );
         my $origcredentialclass = $credentialclass;
         $credentialclass =~ s/Catalyst::Authentication/Catalyst::Plugin::Authentication/;
 
         eval { Catalyst::Utils::ensure_class_loaded( $credentialclass ); };
         if ($@) {
+            # Likewise this croak is useful if the second exception is also "not found",
+            # but would be confusing if it's anything else.
+            die unless $@ =~ /^Can't locate/;
             Carp::croak "Unable to load credential class, " . $origcredentialclass . " OR " . $credentialclass . 
                         " in realm " . $self->name;
         }
@@ -87,11 +93,17 @@
     };
     
     if ($@) {
+        # If the file is missing, then try the old-style fallback, 
+        # but re-throw anything else for the user to deal with.
+        die unless $@ =~ /^Can't locate/;
         $app->log->warn( qq(Store class "$storeclass" not found, trying deprecated ::Plugin:: style naming. ) );
         my $origstoreclass = $storeclass;
         $storeclass =~ s/Catalyst::Authentication/Catalyst::Plugin::Authentication/;
         eval { Catalyst::Utils::ensure_class_loaded( $storeclass ); };
         if ($@) {
+            # Likewise this croak is useful if the second exception is also "not found",
+            # but would be confusing if it's anything else.
+            die unless $@ =~ /^Can't locate/;
             Carp::croak "Unable to load store class, " . $origstoreclass . " OR " . $storeclass . 
                         " in realm " . $self->name;
         }




More information about the Catalyst-commits mailing list