Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does anyone have experience with Perl5i?

Tags:

perl

perl5i

I occasionally see Perl5i being mentioned. It looks great and make things easier. Some questions:

  1. Is this module compatible with other modules, e.g. Dancer, Mojolicious, XML::RSS, etc.?

  2. It it compatible with Moose, or does it have better OO features?

  3. It wraps the best CPAN modules, if my script 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.

like image 589
Weiyan Avatar asked Sep 25 '11 10:09

Weiyan


1 Answers

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.

like image 71
Schwern Avatar answered Oct 17 '22 12:10

Schwern