in reply to Re: Porting Perl 5.6 to Perl 5.8 issue with self-tie
in thread Porting Perl 5.6 to Perl 5.8 issue with self-tie

Hey shmem,

This looks like what I'm looking for! I had tried combos of saving STDOUT and killing the tee, but not in this configuration. I'll give this a try. This could explain why I was having trouble with STDERR as well.

Thanks - Rick

  • Comment on Re^2: Porting Perl 5.6 to Perl 5.8 issue with self-tie

Replies are listed 'Best First'.
Re^3: Porting Perl 5.6 to Perl 5.8 issue with self-tie
by fwashbur (Sexton) on Dec 11, 2006 at 23:45 UTC
    Hi shmem,

    I tried this scheme on my system. It ran into the same issue I had when trying the example out of the O'Reilly book. The first log works great, but the second log attempt results in the following error at the first print statement: tee: write error: Invalid argument

    Are you running this on 5.8? Could there be an issue with my 'tee'?

    Thanks - Rick

      Hmm. Yes, I'm running 5.8, and no, I guess it's not an issue with tee. Strange.

      Next I would do is wrapping tee with a shell script which traces tee, to see what it does, specifically open/closes. Log the fileno() of your STDERR and STDOUT to the apache error log (real STDERR ;-) as well as the fileno() of your redirected handles. Ah, and you could omit the close STDOUT - just re-open it. I didn't check the return value of close (shame on me) which you should do.

      Could you provide a condensed version of the code you are running?

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}