Be extra specially lazy with $c->user if Want is available
Yuval Kogman [Sun, 27 Nov 2005 18:29:29 +0000 (18:29 +0000)]
Build.PL
lib/Catalyst/Plugin/Authentication.pm

index 546f333..9116dde 100644 (file)
--- 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,
 );
index 1355eff..32b23da 100644 (file)
@@ -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<Catalyst::Plugin::Authentication::Store::Minimal::Backend>.
 
+
 =item get_auth_store $name
 
 Return the store whose name is $name.