Slash Boxes
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.
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

    • 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

  • What you are doing sounds quite a bit like what IPC::Run3 does.

    Is it missing something, or does it do something in a way that doesn't work for you? Have you heard of it?
    • It kind of evolved, I'd be tempted to replace it with IPC::Run but only if it others exactly the same stuff without adding complexity.

      Although, to be honest - it's working very nicely now

      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;