Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • First of all, thanks for sharing -- that's useful stuff. But have you considered local() instead of copying something and then copying it back at the end?
    eval {
        local *CORE::GLOBAL::exit = sub {
            warn localtime() ." pid : $$ attempted to exit! caller : ", join(', ',caller()),"\n";
        };
        $ok = do "$filename";
        $error = "couldn't parse $filename: $@" if $@;
        $error = "couldn't do $filename: $!"    unless defined $ok;
        $error = "couldn't run $filename"       unless $ok;
    };

    -Dom

    • yes I tried it - despite having being in an anon block inside an eval it didn't descope for some reason - possibly I fluffed it, but exits ended up getting caught in unexpected places elsewhere in the program.
      --

      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;
      • Dom's code won't work because core subroutines can only be overridden at compile-time. Also you don't need to store a copy of *CORE::GLOBAL::exit as it can always be found in CORE::exit (although you can't take a reference to it so just use a wee closure e.g *CORE::GLOBAL::exit = sub { CORE::exit $_[0] };).
        --

        broquaint out