in reply to There be dragons (or, perl5.8's open stringref breaks...)

the problem with scalars refs used as streams is that they lack an OS file descriptor. They live exclusively at the PerlIO layer, which is fine most of the time for perl scripts, but it isn't for external C libraries or even perl functions that wrap OS calls expecting a file descriptor as an argument.

Send a bug report to File::Copy author!.

  • Comment on Re: There be dragons (or, perl5.8's open stringref breaks...)

Replies are listed 'Best First'.
Re^2: There be dragons (or, perl5.8's open stringref breaks...)
by Tanktalus (Canon) on Apr 24, 2005 at 21:07 UTC

    Yeah ... I was hoping the PerlIO abstracted this, too ;-)

    What would be really cool is to be able to do this:

    { local *STDOUT; my $buf; open STDOUT, '>', \$buf; system("some_command","with","args"); $logger->write($buf); }
    But that's probably expecting a bit much. ;-)

    Anyway, as I said in the original post of the thread, I can't quite figure out who the author is - probably owned by p5p anyway. So I submitted the bug report - we'll see if there's any answer. I do still think, however, that this is a much larger problem than I would be able to give a reasonable patch for, since getting it to work properly may involve many, many changes, or just one: disallow string-handles in File::Copy.