Try this approach: (updated) First, add the following lines to one of your scripts, starting at approximately the second line of the script, to test my method:
no warnings 'layers';
use open ':locale';
use warnings 'all';
If that works, then test the following Perl one-liner on another one of your scripts. It will modifiy the script itself.
perl -pi.bak -e "if( $. == 2 ) { $_ = q/no warnings 'layer';\n use ope
+n ':locale';\nuse warnings 'all';\n$_/;}" myscript.pl
...where, after testing to make sure it didn't completely wreck "myscript.pl", you go ahead and run that on all the scripts you need modified. The effect will be to add the following line to the 2nd line of each script on which you run the command:
no warnings 'layer'; # This squelches any warning due
# to the open pragma not being able to find
# a locale definition in your environment
# variables.
use open ':locale'; # set a default locale for all IO
# in your script based on env vars.
use warnings 'all';
Please read documentation on the open pragma to understand what is at work here. And PLEASE test this on just one script first; I haven't tested it.
|