ajmalton has asked for the wisdom of the Perl Monks concerning the following question:
Wise ones, is there a way to open with a custom PerlIO layer by default? The Layer I'm using is File::BOM. Of course, I could change all my opens to File::BOM::open_boms, but I don't want to change the (legacy) code, I want to change the environment it runs in.
I understand how to open(FILE,"<:via(Layer)", $path), and what it means. But I want open(FILE,$path) to "default" to :via(Layer).
Lacking wisdom, I tried combinations of
and evenuse open ':via(Layer)' use Layer use open 'via(Layer)'
env PERLIO='via(Layer)'
The usual result is
and my surprise thereat shows that there is something about PerlIO::via that I do not understand.Unknown PerlIO layer class ':via(Layer)' at ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: open via
by repellent (Priest) on Oct 30, 2011 at 21:50 UTC |