(Top) < Using Other Templating Systems | Additional Functions (con't) > |
sub cgiapp_prerun { my $webapp = shift; $webapp->prerun_mode('block_access') unless $ENV{'REMOTE_USER'}; } |
If you create a cgiapp_prerun() method, it is called right after setup().
Can't use prerun_mode() inside a run-mode
So just return a new method call:
sub this_run_mode { my $webapp = shift; # ... if ($some_condition_is_true) { my $new_mode = "some_other_run_mode"; return $webapp->$new_mode; } } |
CGI::Application (v.2.0) |
30 |