Dual-Life / autodie

Make functions succeed or die in Perl, with lexical scope.

Home Page:https://metacpan.org/pod/autodie

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autodie clobbers other modules’ use of %^H

FGasper opened this issue · comments

https://github.com/FGasper/p5-Sys-Binmode/blob/d0275134fc410f4ebfdfaac9deaeb54b7a69f10e/t/autodie.t

^^ This test fails (TODO notwithstanding) when autodie is loaded and succeeds when it’s not. From my digging it appears that autodie makes it so that $^H{'Sys::Binmode/enabled'} is always false/missing, which of course breaks Sys::Binmode.

I'm worried that local $^H will break the behavior of autodie. What are your thoughts @FGasper ?

That’s possible. As I recall, autodie empties $^H, which is because it needs it somehow, but I don’t recall details, alas.

Really, IMO https://github.com/Leont/autocroak should (eventually) replace autodie. The pure-Perl approach relies on some really dark-magic-y Perl hackery, whereas the XS way is pretty straightforward, and it catches things like print and readline, which autodie can’t do.