No description, website, or topics provided.
Perl
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/Catalyst/Plugin
t
.gitignore
README.pod
dist.ini

README.pod

NAME

Catalyst::Plugin::Moostash - Provides Moose interface for stash

VERSION

version v0.1.2

DESCRIPTION

Define your Moostash class:

package MyApp::Moostash;

use Moose;
extends 'Catalyst::Plugin::Moostash::Base';

has user_id => (
    is     => 'ro',
    isa    => 'Int',
    writer => 'set_user_id',
);

Load plugin in MyApp class:

use Catalyst qw/
    ConfigLoader
    Static::Simple
    ...
    Moostash
/;

Then use it in your application:

sub some_action : Local {
    my ($self, $c) = @_;

    $c->moostash->set_user_id($user_id);
}

Since the Moostash object is stored in the stash, you can conveniently access it from your View:

[% m.user_id %]

Also, note that Moostash object receives Catalyst context object into the ctx attribute.

CONFIGURATION

__PACKAGE__->config(
    'Plugin::Moostash' => {
        stash_key => 'm',
        class => 'MyApp::Moostash',
    },
);

stash_key

Defines which stash key to use for storing Moostash object.

Default: m

class

Defines Moostash class name.

Default: MyApp::Moostash

AUTHOR

Roman F. <romanf@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Roman F..

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