What you want to do is, if myRunmodeA finds a problem, switch to myRunmodeB. There's nothing particularly magic about the run mode -- once your CGI::Application has been brought to life by the user, you are a class, so you can just call myRunmodeB, i.e. (using code from my example above):sub myRunmodeA { my $self = shift; my $isOK = blah (foo, bar) ... } sub myRunmodeB { my $self = shift; fixBlahProblem(); ... } sub blah { return if param('problem') eq 'true'; }
sub myRunmodeA { my $self = shift; if( blah (foo, bar) ) { #usual code } else { return $self->myRunmodeB; } }
(You might want to set the runmode before hopping into myRunmodeB, just for good luck. You probably do that with $self->{rm} = 'myRunmodeB', but this depends on how you set things up in CGI::Application:setup).
Hope that helps!
Alan
In reply to Re: Changing run mode in cgi::application
by aktbar
in thread Changing run mode in cgi::application
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |