hotshot has asked for the wisdom of the Perl Monks concerning the following question:
As you can see, in each function that calls &getParam() (inderectly) I have to check the return value all the way up to the main loop. Is there a way to avoid all the checks and return somehow immediatelly from getParam() to the main loop (after the call to execCommand())?sub getParam { if ($someCondition) { return 0 } ... return 1; } sub execCommand { ... if (! &func1()) { return 0; } ... return 1; } sub func1 { ... if (! &getParram()) { return 0; } .. return 1; } # CLI main loop while ($input = $term->readline("\n$prompt > %n", $TRUE)) { &execCommand($input); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CLI and problems
by esh (Pilgrim) on Aug 17, 2003 at 17:25 UTC | |
|
Re: CLI and problems
by dreadpiratepeter (Priest) on Aug 17, 2003 at 16:15 UTC | |
|
Re: CLI and problems
by mattriff (Chaplain) on Aug 17, 2003 at 16:11 UTC | |
|
Re: CLI and problems
by benn (Vicar) on Aug 17, 2003 at 16:12 UTC | |
|
Re: CLI and problems
by Anonymous Monk on Aug 17, 2003 at 22:58 UTC |