CatalystX::FeedbackMessages - Easy way to stuff "status" messages into your stash


CatalystX-FeedbackMessages documentation Contained in the CatalystX-FeedbackMessages distribution.

Index


Code Index:

NAME

Top

CatalystX::FeedbackMessages - Easy way to stuff "status" messages into your stash

VERSION

Top

version 0.0603

SYNOPSIS

Top

    use Catalyst qw/
        ...
    +CatalystX::FeedbackMessages
    /;

    # later...

    package MyApp::Controller::Blargh;
    ...

    sub fnargh : Local {
        my ($self, $c) = @_;
        ## do some form submission stuff
        if( $form_stuff_is_successful ) {
            $c->msg("Successful submission is successful!");
        }
    }




Open up your wrapper and add these lines:

    [% FOR message IN messages -%]
        [% message %]
    [% END -%]

(Add formatting as you please)

DESCRIPTION

Top

This module was inspired while working with Mischa Spiegelmock on a Catalyst project. He had put together a small plugin/mixin (astonishingly similar to this one :-) that allowed you to add an arbitrary number of messages to $c-stash> via an arrayref which could be iterated through by Template::Toolkit.

METHODS

Top

msgs $message

  Push a message into the array

CONFIGURATION

Top

None, yet.

AUTHORS

Top

Devin Austin, <dhoss@cpan.org>

With thanks to Mischa Spiegelmock

TODO

Top

Allow user to specify names for message keys

SEE ALSO

Top

I dunno :-)

COPYRIGHT & LICENSE

Top


CatalystX-FeedbackMessages documentation Contained in the CatalystX-FeedbackMessages distribution.
package CatalystX::FeedbackMessages;
use Moose::Role;

# ABSTRACT: Add "status messages" to your app, easy like!

our $VERSION = '0.0603'; 
sub msg {
    my ($c, $msg) = @_;
    $c->stash->{messages} ||= [];
    # I'm wondering if this can't be done more purdier
    push @{$c->stash->{messages}}, $msg if $msg;
}

1;