February 2012 Archives

require vs Module::Load benchmark

Since I often do:

sub some_func {
    require Some::CPAN::Module;
    ....
}

to delay loading of modules, I am interested in how much overhead this introduces.

After first successful require(), the subsequent require()'s of the same module is very fast (around 0.08µ on my PC) because all Perl does is just convert Some::CPAN::Module to Some/CPAN/Module.pm and check this against %INC. This kind of overhead is comparable to that of an empty subroutine call.

If we change the require line to

l…

Downvoting unsupported modules

A new, late, new year's resolution for 2012: rate unsupported modules with 1 star. Two such examples. By unsupported, I mean tickets are not responded at all (let alone bugs fixed) for months or even years. Perhaps module-starter should emit this POD section template instead:

=head1 BUGS

Please report any bugs or feature requests to
C<bug-foo-bar at rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Foo-Bar>.
I will be…

About Steven Haryanto

user-pic A programmer (mostly Perl 5 nowadays). My CPAN ID: SHARYANTO. I'm sedusedan on perlmonks. My twitter is stevenharyanto (but I don't tweet much). Follow me on github: sharyanto.