From: Yuval Kogman Date: Sun, 27 Nov 2005 18:29:29 +0000 (+0000) Subject: Be extra specially lazy with $c->user if Want is available X-Git-Tag: v0.01~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a1e5bd364c4587849133c3d4a921b640f633d4f7;p=catagits%2FCatalyst-Plugin-Authentication.git Be extra specially lazy with $c->user if Want is available --- diff --git a/Build.PL b/Build.PL index 546f333..9116dde 100644 --- a/Build.PL +++ b/Build.PL @@ -6,9 +6,10 @@ my $build = Module::Build->new( license => 'perl', module_name => 'Catalyst::Plugin::Authentication', requires => { - 'perl' => '5.8.1', - 'Catalyst' => '5.49', + 'perl' => '5.8.1', + 'Catalyst' => '5.49', }, + reccomends => { 'Want' => 0, }, create_readme => 1, sign => 1, ); diff --git a/lib/Catalyst/Plugin/Authentication.pm b/lib/Catalyst/Plugin/Authentication.pm index 1355eff..32b23da 100644 --- a/lib/Catalyst/Plugin/Authentication.pm +++ b/lib/Catalyst/Plugin/Authentication.pm @@ -15,6 +15,11 @@ use warnings; use Tie::RefHash; use Class::Inspector; +BEGIN { + require constant; + constant->import(have_want => eval { require Want }); +} + our $VERSION = "0.01"; sub set_authenticated { @@ -43,6 +48,7 @@ sub user { my $user = $c->_user; if ( $user and !Scalar::Util::blessed($user) ) { + return 1 if have_want() && Want::want("BOOL"); return $c->auth_restore_user($user); } @@ -235,6 +241,7 @@ or by using a Store plugin: Sets the default store to L. + =item get_auth_store $name Return the store whose name is $name.