in reply to Entering and exiting subs in style

You should never call exit from more than one place in your code. If you do, that would become a maintenance nightmare to other people, who might support your code.

More importantly, there is absolutely no logical need for this kind of style, as your code should always be coded in a way decent enough to handle all exceptions, and properly return from subs accordingly.

If your code does not do that, then fix it, not to tolerate it.

Indeed, this breaks modulization, as now other modules are performing functionality (in this case, exit function) that should only be performed by your main module.

Purity is not a kind of requirement, but a kind of belief.

Replies are listed 'Best First'.
Re: Re: Entering and exiting subs in style
by melora (Scribe) on May 27, 2004 at 18:45 UTC
    Why is using return() inadequate? I think I missed that part. Is it a matter of style and personal preference? I usually use return in all cases, and use returned values to distinguish a "die" situation from a successful return. Part of the reason is that I sometimes need to give the program a chance to "put away its crayons", so to speak. I realize, of course, that there's more than one way to do it. I just want to ask whether I'm missing out by doing it in my old-fashioned way.