(You are Anonymous)

Suggestions for simple and effective run mode names

It helps, as your application grows, to use meaningful names for run modes. When your application gets large it is hard to remember what 'mode34' does.

sub setup {
    my $self = shift;
    $self->start_mode( 'home' );
                     'home'     => 'show_home',
                     'services' => 'show_services',
                     'news'     => 'show_news',
                     'calendar' => 'show_calendar',
    # keep templates out of document root

When developing projects using forms, you have run modes to display the form and run modes to process it. One organization tool is to give related run modes a common prefix. This can be the name of the entity being worked with. Then different verb endings can convey the action.

Here's an example that uses CGI::App's syntax to create a list of run modes that map directly to routine names. Space is also used to seperate related routines.




Even easier: CGI::Application::Plugin::AutoRunmode

Look into CGI::Application::Plugin::AutoRunmode for a way to skip this step completely and declare your run modes like this instead:

sub item_add_process : Runmode { ... }