Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • How about duping the filehandle?
    • That's not a bad idea. Although there's still too many layers going on here. The filehandle goes from a PerlIO* to a FILE* to an fd. And then I'd have to dup, and fdopen(). A touch complicated, but it should work well.

      Thanks,
      -Dom

  • I think it's worthwhile to think about what should happen if someone passes you a Perl filehandle, then closes it before EndDocument().

    What would happen with a duped filehandle? Would the duped one stay open if the original one gets closed?

    I think that it should behave the way a pure-Perl module mostly like would: closing the filehandle closes it out from under the module, too. The duping behaviour seems safer, but I worry that this safety net could veil bugs in client code, in which case

    • Unfortunately, that behaviour caused a segfault in some cases, which is why I was so keen to avoid it. I've worked around it by storing the file handle in a hash in the latest version, and releasing it when EndDocument() is called.

      -Dom

      • Which means closing the Perl filehandle while GenX has a copy of it will blow in my face if I try it? That would be good, if so, and is all I was arguing for.
        • It might do, it might not. The behaviour was extremely variable and core dumped on some boxes but not others. Given the unpredicatbility, I felt that it was the right thing to do to store a reference to the filehandle until we're done with it.

          -Dom