Sixtease has asked for the wisdom of the Perl Monks concerning the following question:
Friends,
I was refactoring my code. I had a subroutine that did
begin(); stuff(); if (something went wrong) { return } more_stuff(); end();
Now I refactored stuff into another subroutine:
begin(); do_stuff(); end(); sub do_stuff { stuff(); if (something went wrong) { return } more_stuff(); }
But now, if (something went wrong) { return } won't exit the calling subroutine. How do I exit from the caller? Is there a better way than, say, returning a special value or setting an $ERRNO variable?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: exit calling subroutine
by moritz (Cardinal) on Jan 10, 2008 at 08:20 UTC | |
Re: exit calling subroutine
by jbert (Priest) on Jan 10, 2008 at 09:14 UTC | |
Re: exit calling subroutine
by Zaxo (Archbishop) on Jan 10, 2008 at 08:31 UTC | |
Re: exit calling subroutine
by jwkrahn (Abbot) on Jan 10, 2008 at 09:02 UTC | |
by ikegami (Patriarch) on Jan 10, 2008 at 17:40 UTC | |
Re: exit calling subroutine
by tweetiepooh (Hermit) on Jan 10, 2008 at 15:44 UTC | |
Re: exit calling subroutine
by Sixtease (Friar) on Jan 10, 2008 at 15:00 UTC | |
by Anonymous Monk on Jan 10, 2008 at 15:52 UTC | |
Re: exit calling subroutine
by Sixtease (Friar) on Jan 10, 2008 at 18:43 UTC |