Ack, IO::File. It should be dying before the "No such file or directory" error: latin1 is not a valid encoding name, and with warnings enabled it should croak with 'Unknown PerlIO layer "latin1"'; the second argument of open expects the canonical name, which is iso-8859-1. Unfortunately, IO::File doesn't have warnings on internally: the best long-term solution, if feasible, would be to change all the IO::File uses with simple opens, but a good intermediate step would be to wrap those calls like this:
{
local $^W = 1; # $WARNING with use English
IO::File->new(...);
}
Or maybe wrap the constructor's glob itself, But that seems like a lot of work for too little gain.
In any case, the solution to the base problem is pretty simple: $charset should get a sane default, and also go through Encode::resolve_alias() before being passed to open() or IO::File.
(There's also another possible problem here: if $charset were to somehow be an empty string, you would end up with >>: or similar as the mode, which is magical -- It'll skip fetching context layers set by 'use open qw( yadda )'; might be best to have those colons be part of $charset)
Ack, IO::File. It should be dying before the "No such file or directory" error: latin1 is not a valid encoding name, and with warnings enabled it should croak with 'Unknown PerlIO layer "latin1"'; the second argument of open expects the canonical name, which is iso-8859-1. Unfortunately, IO::File doesn't have warnings on internally: the best long-term solution, if feasible, would be to change all the IO::File uses with simple opens, but a good intermediate step would be to wrap those calls like this:
{ File->new( ...);
local $^W = 1; # $WARNING with use English
IO::
}
Or maybe wrap the constructor's glob itself, But that seems like a lot of work for too little gain.
In any case, the solution to the base problem is pretty simple: $charset should get a sane default, and also go through Encode: :resolve_ alias() before being passed to open() or IO::File.
(There's also another possible problem here: if $charset were to somehow be an empty string, you would end up with >>: or similar as the mode, which is magical -- It'll skip fetching context layers set by 'use open qw( yadda )'; might be best to have those colons be part of $charset)