Fix bug, I think
Tomas Doran [Thu, 20 May 2010 16:47:27 +0000 (16:47 +0000)]
Changes
lib/Catalyst/Plugin/Cache.pm

diff --git a/Changes b/Changes
index 01f9817..127b3e3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+        - Change to Module::Install
+        - Drop test dep on ok
+        - Split requires and test_requires
+        - Fix bug when used in conjunction with ::Model::DBIC::Schema
+          Caching trait by not trying to cache the curried cache instance when
+          we don't have a request instance to cache it against
+
 0.09
         - Generate a warning if no config is specified, or config
           is specified using the old key.
index 791cc95..3497699 100644 (file)
@@ -12,7 +12,7 @@ use Scalar::Util ();
 use Catalyst::Utils ();
 use Carp ();
 use MRO::Compat;
-
+use Scalar::Util qw/ blessed /;
 use Catalyst::Plugin::Cache::Curried;
 
 __PACKAGE__->mk_classdata( "_cache_backends" );
@@ -154,7 +154,7 @@ sub cache {
     if ( @meta == 1 ) {
         my $name = $meta[0];
         return ( $c->get_preset_curried($name) || $c->get_cache_backend($name) );
-    } elsif ( !@meta ) {
+    } elsif ( !@meta && blessed $c ) {
         # be nice and always return the same one for the simplest case
         return ( $c->_default_curried_cache || $c->_default_curried_cache( $c->curry_cache( @meta ) ) );
     } else {