#!/usr/bin/perl
package Catalyst::Plugin::Cache;
-use base qw(Class::Accessor::Fast Class::Data::Inheritable);
+use Moose;
-use strict;
-use warnings;
+with 'Catalyst::ClassData';
-our $VERSION = "0.08";
+our $VERSION = "0.12";
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" );
-__PACKAGE__->mk_accessors( "_default_curried_cache" );
+has _default_curried_cache => (
+ is => 'rw',
+);
+no Moose;
sub setup {
my $app = shift;
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 {