Odd issue with in-memory filehandles being cut off with Pod::Simple
Fayland Lam apparently got tired of me sending him patches so I released his Dist::Zilla::Plugin::ReadmeFromPod on CPAN today with some fixes, yay for GitHub powered collaboration.
Fayland previously released version 0.05 with a patch of mine which replaced IO::Scalar with an in-memory open(). This fixed an issue with PODs with non-ASCII E<> characters but introduced another one.
For some reason using in-memory open() like this yields a POD that's cut off, here's a test for it via Gist. I couldn't find out why in-memory open() behaved like this so I just used temporary files instead and released that as 0.06.
Theoretically I could have avoided all this by using Pod::Simple's output_string
method to save the processed POD to a string instead of a filehandle, only that brought me right back to square one since that too has encoding issues.
Every once in a while I run into some odd encoding issues which I just have to give up and work around. In this case Pod::Simple is actually reading a pure ASCII file with =encoding utf8
but for some reason it's deciding against generating UTF-8 output unless PerlIO apparently does it for it.
Encoding issues are hard, especially when they're happening in some huge & opaque module that literally includes a file called Blackbox.pm
. I think I understand perl's encoding model pretty well though, but "if you think you understand [perl's encoding handling], then you don't understand [perl's encoding handling]".
Leave a comment