Subject: | Progressive loading of Exporter.pm |
Could save a little time and memory and avoid loading Exporter.pm for those people who don't want to import any functions.
Basically, get rid of the `require Exporter` in Scalar::Util, List::Util, and Sub::Util, and replace it with your own `import` sub:
sub import {
return unless @_;
require Exporter;
my $import = \&Exporter::import;
no warnings "redefine";
*import = $import;
goto $import;
}
This means that people who want to do:
use Scalar::Util;
if (Scalar::Util::looks_like_number($foo)) {
...;
}
... won't have Exporter.pm loaded into memory.
Yeah, I know it's only a small module if you don't accidentally trigger Exporter::Heavy getting loaded. But given how essential Scalar::Util and its friends are, I think it's worth considering.