Skip to content

niceperl/Kelp-Module-FlashMessage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Kelp::Module::FlashMessage - Kelp flash message support

VERSION

version 0.01

SYNOPSIS

Module configuration:

# conf/config.pl
{
    modules      => ['FlashMessage'],
    modules_init => {
        'FlashMessage' => {
           key => 'flash_custom_key' 
           # optional custom key name, the default is 'km::flash'
           # it will be used to store the flash message into the session
        },
    }
}

Usage (from a route)

package MyApp;
use Kelp::Base 'Kelp';

sub some_route {
   my $self = shift;
   $self->flash_message('my flash message' );
   return $self->template('my_template', {
            'fmp' => sub { $self->flash_message_present },
            'fm'  => sub { $self->flash_message }
          });   
}

And finally, the template that consumes the flash message (Text::Xslate example):

: if $fmp()  {
Message: <: $fm() :>
: }

: if $fmp()  {
Message (should you see this? - no!)
There isn't flash message after you consume it
: }

REQUIREMENTS

It needs the Plack::Middleware::Session to work properly. See the adding middleware section in the main Kelp documentation.

REGISTERED METHODS

This module registers two methods into the application:

flash_message

get/sets the flash message. When you get the flash message value, it is deleted.

flash_message_present

returns a true value if the flash message is present. It may be called many times without clear the message

AUTHOR

Miguel Prz, <niceperl at gmail.com>

BUGS

Please report any bugs or feature requests through the web interface at https://rt.cpan.org/Public/Dist/Display.html?Name=Kelp-Module-FlashMessage. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Kelp::Module::FlashMessage

You can also look for information at:

ACKNOWLEDGEMENTS

To Stefan Geneshky, the creator of great Kelp web framework

COPYRIGHT & LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

About

Kelp flash message support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages