in reply to END failed --- call queue aborted

I may be missing something, but why call exit at all?
  • Comment on Re (tilly) 1: END failed --- call queue aborted

Replies are listed 'Best First'.
Re^2: END failed --- call queue aborted
by tye (Sage) on Aug 23, 2000 at 19:54 UTC

    I always write code as:

    #!/usr/bin/perl -w use strict; #[globals here] exit main(); #[subs here] sub main { #code here return 0; }

    In that case, the exit has two purposes. One, prevent execution of dangling code between the subroutines (which should be in BEGIN blocks if you meant it to be there). Two, give a place to set a break point when debugging. ...THREE! threefold! Also encourages placing objects into "sub main" so that they get destroyed in an orderly fashion. ...FOUR! And a fanatical devotion to write code that looks like C. No, wait! It was only threefold after all.

    (though I think I'm forgeting another reason...)

            - tye (but my friends call me "Tye")
RE: Re (tilly) 1: END failed --- call queue aborted
by KM (Priest) on Aug 23, 2000 at 19:48 UTC
    I may be missing something, but why call exit at all?

    exit doesn't mess up an END block, die does. I am not sure when calling exit in an END block is needed either though.

    Cheers,
    KM

      I wasn't saying that it was a problem. It just looked to me like someone jumping through hoops to make their Perl look like C.

      I was wondering if they were actually using the construct for something useful.