in reply to Manipulating END blocks

Why don't you use a flag instead of messing with internal structures?

my $server_running = 0; END { if ($server_running) { ... } }

When appropriate, toggle $server_running.

( Oops, I didn't notice someone had already replied. )

Replies are listed 'Best First'.
Re^2: Manipulating END blocks
by DrWhy (Chaplain) on Sep 13, 2007 at 20:16 UTC
    Because I like messing with Perl's internal structures ;)

    Actually I realized the same thing after I posted this question, and that's how I'm going to implement this in this case.

    I still would like to hear other's thoughts on the general question of how best to manipulate END routines when there's not a more straightforward way to accomplish the same effect.

    --DrWhy

    "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

      Well, nothing is stopping you from eval'ing some code that defines the END block you want. That's probably the simplest way to do it.