Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    CGI::Application::Plugin::MessageStack 0.34

    Download button

    No screenshots available
    Downloads: 410  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.7/5)
    9 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Jason Purdy | More programs
    Perl Artistic License / FREE
    April 8th, 2008, 15:09 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    CGI::Application::Plugin::MessageStack description

    A message stack for your CGI::Application

    CGI::Application::Plugin::MessageStack is a message stack for your CGI::Application.

    SYNOPSIS

    This plugin gives you a few support methods that you can call within your cgiapp to pass along messages between requests for a given user.

    use CGI::Application::Plugin::Session;
    use CGI::Application::Plugin::MessageStack;

    sub mainpage {
    my $self = shift;
    my $template = $self- >load_tmpl( 'mainpage.TMPL', 'die_on_bad_params' = > 0 );
    # ...
    $template- >output;
    }

    sub process {
    my $self = shift;
    $self- >push_message(
    -scope = > 'mainpage',
    -message = > 'Your listing has been updated',
    -classification = > 'INFO',
    );
    $self- >forward( 'mainpage' );
    }

    sub cgiapp_init {
    # setup your session object as usual...
    }

    Meanwhile, in your (HTML::Template) template code:

    ...
    < style type="text/css" >
    .INFO {
    font-weight: bold;
    }
    .ERROR {
    color: red;
    }
    < /style >
    ...
    < h1 >Howdy!< /h1 >
    < !-- TMPL_LOOP NAME="CAP_Messages" -- >
    < div class="< !-- TMPL_VAR NAME="classification" -- >" >
    < !-- TMPL_VAR NAME="message" -- >
    < /div >
    < !-- /TMPL_LOOP -- >
    ...

    It's a good idea to turn off 'die_on_bad_params' in HTML::Template - in case this plugin tries to put in the parameters and they're not available in your template.

    Here's a quick TT example:

    < style type="text/css" >
    .INFO {
    font-weight: bold;
    }
    .ERROR {
    color: red;
    }
    < /style >
    ...
    < h1 >Howdy!< /h1 >
    [% FOREACH CAP_Messages %]
    < div class="[% classification %]" >[% message %]< /div >
    [% END %]
    ...


    If you use TT, I recommend using CAP-TT and a more recent version (0.09), which supports cgiapp's load_tmpl hook and then this plugin will automatically supply TT with the relevant messages. Your runmode could be this simple:

    sub start {
    my $self = shift;
    my $session = $self- >session;
    return $self- >tt_process( 'output.tt' );
    }


    I don't have the experience to weigh in on how you'd do this with other templates (HTDot, Petal), but basically, this plugin will put in a loop parameter called 'CAP_Messages'. Within each element of that loop, you'll have two tags, 'classification' and 'message'.

    NOTE: I have broken backwards compatibility with this release (0.30) and the loop parameter's default name is now 'CAP_Messages'. If you used the old __CAP_Messages or want to use another name, feel free to use the capms_config to override the -loop_param_name.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    message stack | CGI::Application plugin | Perl module | CGI::Application | message | stack

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM