John Napiorkowski

NAME

Catalyst::Plugin::Session::Store::TestMemcached - Automatic creation of test Memcached instance

SYNOPSIS

In your Catalyst application class:

    package MyApp::Web;

    our $VERSION = '0.01';

    use Moose;
    use Catalyst qw/
      Session
      Session::Store::TestMemcached
      Session::State::Cookie
    /;

    extends 'Catalyst';

    __PACKAGE__->setup;
    __PACKAGE__->meta->make_immutable;

Later in a controller:

    package MyApp::Controller::Root;

    use Moose;
    use MooseX::MethodAttributes;

    extends 'Catalyst::Controller';

    sub welcome : Path(welcome) {
      my ($self, $ctx) = @_;
      my $count = ++$ctx->session->{count};
      $ctx->session(count => $count);
      $ctx->res->body("Welcome to Catalyst: $count");
    }

    __PACKAGE__->meta->make_immutable;

DESCRIPTION

This uses Test::Memcached to make an application scoped instance of a memcached server, so that if you want to test using memcached as a store for sessions you don't need to run it in a separate job.

This is probably useful only for testing and prototypes. Additionally, many people suggest using memcached, which is not really a persistent data store, for sessions is not a great practice. As you wish!

AUTHOR

John Napiorkowski email:jjnapiork@cpan.org

SEE ALSO

Catalyst::Plugin::Session::Store::Memcached, Catalyst::Plugin::Session, Catalyst, Test::Memcached

COPYRIGHT & LICENSE

Copyright 2012, John Napiorkowski email:jjnapiork@cpan.org

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.