Subject: | "Can't locate object method "cache" via package "RateLimit" |
Hi,
Caught exception in RateLimit::Controller::test->index "Can't locate object method "cache" via
package "RateLimit" at /opt/local/lib/perl5/site_perl/5.12.4/Catalyst/Controller/RateLimit.pm
line 88."
I'm on the latest Catalyst version using:
package RateLimit::Controller::test;
use Moose;
use namespace::autoclean;
BEGIN { extends qw/ Catalyst::Controller::RateLimit / }
#
# Sets the actions in this controller to be registered with no prefix
# so they function identically to actions created in MyApp.pm
#
__PACKAGE__->config(
rate_limit_backend_name => 'Cache::Memcached::Fast',
# ^- Optional. Only if your module is not Cache::Memcached::Fast
# child, but has the same behavior.
rate_limit => {
default => [
{
attempts => 30,
period => 3600,
},
{
attempts => 5,
period => 60,
}
]
}
);
=head1 NAME
RateLimit::Controller::Root - Root Controller for RateLimit
=head1 DESCRIPTION
[enter your description here]
=head1 METHODS
=head2 index
The root page (/)
=cut
sub index : Path : Args(0) {
my ( $self, $c ) = @_;
if (
$self->flood_control->register_attempt(
$c->user->login || $c->request->address
)
)
{
$c->response->body(
$self->flood_control->get_attempt_count(
'default', $c->user->login || $c->request->address
)
);
}
}