utf8::all and autodie now coexist peacefully

autodie version 2.12 works with use open now.

Recently I was reading a program that was using utf8::all and I decided to take another look at the module. The last time I tried it out was version 0.003 from 2011 and it basically did the following:

use utf8;
use open ( :std :encoding(UTF-8) );
use charnames ( :full :short );

@ARGV = map { decode_utf8($_, 1) } @ARGV;

Now autodie did not play nice with use open so that was a blocker for using utf8::all in apps. With the latest version I get use warnings qw( FATAL utf8 ). Looking at the updated POD I see that autodie 2.12 now works correctly with use open. YAY! I have applications using autodie with boilerplate utf8 support and now it is shorter. From this

use utf8;
use 5.014;
use warnings;
use warnings  qw(FATAL utf8);
use charnames qw(:full :short);
use autodie qw(:all);

#plus other stuff in the program

to this

use 5.014;
use warnings;
use autodie qw(:all);
use utf8::all;

I have updated a few of my backup scripts to use the above boilerplate and so far no problems. I was able to remove a few lines here and there and no more “wide character in print” messages which I just ignored before.

I came upon the autodie update by accident so I am keeping up with new releases by keeping an eye on @cpan_new and http://www.metacpan.org/recent.


This is great news! Thanks for posting this :) I use utf8::all and autodie and it always kills me that I can't use them together.

Leave a comment

About Kimmel

user-pic I like writing Perl code and since most of it is open source I might as well talk about it too. @KirkKimmel on twitter