X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAuthentication%2FRealm.pm;h=28ce7ea1e9c6fe168ae71c55095369e5b0e92f51;hb=d5e3af2f76a0b603ff282d161a4f952941b4f93d;hp=9a61a2e7a8f609613499deee2e481f7e8365fa9d;hpb=b51f602d06bd2454f4c76c217dda5ce185a8f74a;p=catagits%2FCatalyst-Plugin-Authentication.git diff --git a/lib/Catalyst/Authentication/Realm.pm b/lib/Catalyst/Authentication/Realm.pm index 9a61a2e..28ce7ea 100644 --- a/lib/Catalyst/Authentication/Realm.pm +++ b/lib/Catalyst/Authentication/Realm.pm @@ -2,6 +2,7 @@ package Catalyst::Authentication::Realm; use strict; use warnings; +use String::RewritePrefix; use base qw/Class::Accessor::Fast/; @@ -41,11 +42,10 @@ sub new { ## follow catalyst class naming - a + prefix means a fully qualified class, otherwise it's ## taken to mean C::P::A::Store::(specifiedclass) - if ($storeclass !~ /^\+(.*)$/ ) { - $storeclass = "Catalyst::Authentication::Store::${storeclass}"; - } else { - $storeclass = $1; - } + $storeclass = String::RewritePrefix->rewrite({ + '' => 'Catalyst::Authentication::Store::', + '+' => '', + }, $storeclass); # a little niceness - since most systems seem to use the password credential class, # if no credential class is specified we use password. @@ -55,11 +55,10 @@ sub new { ## follow catalyst class naming - a + prefix means a fully qualified class, otherwise it's ## taken to mean C::A::Credential::(specifiedclass) - if ($credentialclass !~ /^\+(.*)$/ ) { - $credentialclass = "Catalyst::Authentication::Credential::${credentialclass}"; - } else { - $credentialclass = $1; - } + $credentialclass = String::RewritePrefix->rewrite({ + '' => 'Catalyst::Authentication::Credential::', + '+' => '', + }, $credentialclass); # if we made it here - we have what we need to load the classes