February 2012 Archives

How not to use Moose

Maybe this is legitimate and I just don't know why, but I have seen the following in a couple of projects where I have taken over after the original programmer left:

use Moose;

has [qw/foo bar baz/], is => 'rw';

no Moose;

sub something {}
sub somethingelse {}

OK, I collapsed the attrib declaration into one line for brevity. I will say that from the code, I can tell you these are not Perl programmers, they are old time C programmers with CS degrees who convinced someone they knew what they were doing because the…

Archive::Tar::Wrapper vs. Archive::Tar

If you don't know it, Archive::Tar is SLOW; it even says so. Running NYTProf recently on a project revealed that the major part of the program was taking a little more than 27 seconds to run and a little over 24 seconds of this was Archive::Tar reading the archive into memory. Since I did not need the in memory feature, I switched to Archive::Tar::Wrapper. That sub now takes about 2.5 seconds to run and the equivalent portion to Archive::Tar->new($file); is now Archive::Tar::Wrapper->new; $arch->read($file); now takes 631 ms.

About Jesse Shy

user-pic Perl pays for my travel addiction.