I occasionally see Perl5i being mentioned. It looks great and make things easier. Some questions:
Is this module compatible with other modules, e.g. Dancer, Mojolicious, XML::RSS, etc.?
It it compatible with Moose, or does it have better OO features?
It wraps the best CPAN modules, if my scri开发者_JAVA百科pt uses these…
use strict; use utf8::all; use XML::RSS::JavaScript; use DateTime::Format::Mail;
… should I just replace it with:
use perl5i::2; use XML::RSS::JavaScript; use DateTime::Format::Mail;
Any experience, good and bad, please share.
I'm the primary author of perl5i.
1) perl5i is compatible with other modules. If you find a conflict, let us know. http://github.com/schwern/perl5i/issues
2) Yes, it is compatible with Moose and Mouse. It does not have ambitions to reinvent those wheels. Its contribution to OO is autoboxing, where non-objects can have methods called on them like $string->trim
.
3) In general, you can safely use perl5i with existing code. However, it does do some small backwards incompatible changes, generally to bits of Perl that don't make sense anyway. The biggest things to look out for are 1) file operations (like open) now throw exceptions on failure and 2) utf8::all changes how non text files are read.
My experiences with perl5i are biased. I can say the biggest negatives about perl5i are 1) sometimes there are bugs and its lexical effects leak out of scope 2) the dependency chain is pretty big and 3) some of those dependencies have issues on Windows. The positive sides are how much autoboxing and built-in exceptions change how one writes Perl.
There is a FAQ and I give a talk about perl5i.
精彩评论