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

This code is a simplified example. The real code is much bigger and more complex. And is used for everything from getting data from pipelines (open my $fh, "tar cf - * | gzip -c |";) carrying hundreds of MB of data, to a couple KB of strings. The latter isn't a big deal, the former is. I'm figuring that I'm going to have to perform the copy myself. Not hard to do, but just has to be done. Note that I can't assume anything about the data, so if I want to be efficient (time/memory), I'm going to either have to use sysread or something, or I'm going to have to set $/ to \1024 or something (fixed length read/write, not line-by-line since, as potentially binary data, I don't have any idea what lines are). Not a big deal, but this is what I was using File::Copy for. :-)

I'm just going to rip some of it from File::Copy, and assume the filehandle is good. I do know, however, that the from-handle and the to-filename should not be the same (it would actually be difficult to do), so this should be ok for all but the pathological cases (where someone is simply trying to break something on purpose).

Thanks!