Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
It's a little unclear exactly what you're doing, but I'm guessing it's something like this (code oversimplified but I hope it's clear):
sub myRunmodeA { my $self = shift; my $isOK = blah (foo, bar) ... } sub myRunmodeB { my $self = shift; fixBlahProblem(); ... } sub blah { return if param('problem') eq 'true'; }
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; 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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found