in reply to Which phase am I in?

Those "phases" are just fancy magical subs which permit declaration without the sub keyword. You can happily use caller EXPR to examine the callstack and find out the exact place you were called from.

Replies are listed 'Best First'.
Re^2: Which phase am I in?
by dragonchild (Archbishop) on Nov 19, 2004 at 16:58 UTC
    #!/usr/local/perl5/bin/perl my @x; sub call { push @x, [caller(1)] } BEGIN { call() } CHECK { call() } INIT { call() } END { print "@$_\n" for @x; } END { call() }

    will sometimes give me BEGIN and INIT, sometimes BEGIN, CHECK, and END. But, never all four. What am I doing wrong? I'm on 5.8.4 for Solaris8.

    Update: Of course, I'm not seeing it cause gvim isn't a true IDE. Running from the commandline fixes the problem.

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      ActiveState 5.8.4-810 gives me all four.

      main f.txt 3 main::BEGIN 1 0 0 main f.txt 0 main::CHECK 1 0 0 main f.txt 0 main::INIT 1 0 0 main f.txt 0 main::END 1 0 0