in reply to Re: stderr, local block and redirection
in thread stderr, local block and redirection

Woohoo! that worked! :) Why would setting $output to a non undef value make it work?

Jason L. Froebe

Team Sybase member

No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

  • Comment on Re^2: stderr, local block and redirection

Replies are listed 'Best First'.
Re^3: stderr, local block and redirection
by Fletch (Bishop) on Sep 13, 2006 at 17:43 UTC

    Although it's not explicitly explained that I can find, my guess would be that under the hood it needs an actual not-undef SvPV* into which the data is written. Otherwise it's going to be trying to append things to the single global undefined value &PV_sv_undef which is what throws the error.

      I think the buffer for read and for sysread must be similarly initialized.
      my $read = read($fh, my $buf='', $MAX_READ);

      That makes perfect sense :) Interesting that it only occurs after the first occurance of the code. Into the bowels of the Perl engine I dare not go without asbestos lined bloomers. ;-)

      Jason L. Froebe

      Team Sybase member

      No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1