::Plugin::AutoRunmode, a welcome simplification of CGI::App

markjugg on 2005-07-23T19:06:15

CGI::Application::Plugin::AutoRunmode is a welcome simplification to the common CGI::Application workflow.

It allows you to get rid of setup() while maintaining clarity. An illustration:

before:
sub setup {
    my $self = shift;
    $self->start_mode('my_run_mode');
    $self->runmodes(qw/
        my_run_mode
        another_run_mode
    /);
}

sub my_run_mode {
        # do something here
}

sub another_run_mode  {
        # do something else
}
After:

use CGI::Application::Plugin::AutoRunmode;

sub my_run_mode : StartRunmode {
        # do something here
}

sub another_run_mode : Runmode {
        # do something else
}


Thanks

sigzero on 2005-07-29T12:24:03

I use CGI::App but never saw this one. That is cool.