Idea.
Fatal:
use Module::NoLoad qw( Acme::pwn3d Meta );
Silent:
use Module::NoLoad 'Overrides::SIG::DIE' => { silent => 1 };
Versions (automatically fatal):
use Module::NoLoad 'Some::Versions::Buggy' => { versions => '0.23' }, 'Early::Versions::Buggy' => { versions => '-1.99' };
I read the name and automatically assumed you were writing something which would unload or not load a module. I couldn't imagine how that would be useful, but that's what I assumed.
Cool idea though. Might suggest calling it Module::CheckLoad
or something like that.
Re:Not sure about the name
Ovid on 2008-08-08T10:42:35
"NoLoad" was intentional (better names welcome). For example:
use Module::NoLoad
'Overrides::SIG::DIE' => { silent => 1 };Is equivalent to this:
BEGIN {
$INC{'lib/Overrides/SIG/DIE.pm'} = 'Module::NoLoad';
}This, of course, silently stops this module from being loaded. The fatal version would require a higher version of Perl:
use Module::NoLoad
'Meta', 'Acme::pwn3d';
__END__
# equivalent to:
use Carp;
BEGIN {
my %package_for = (
'Meta.pm' => 'Meta',
'Acme/pwn3d.pm' => 'Acme::pwn3d',
);
unshift @INC => sub {
my $file = $_[1];
if ( my $module = $package_for{$file} ) {
confess "Module::Load blocked loading of '$module'";
}
};
}And so on
... Re:Not sure about the name
jarich on 2008-08-08T11:03:34
Oh I didn't get that.
:) The name now makes perfect sense, and seems very appropriate. Re:Not sure about the name
AndyArmstrong on 2008-08-08T11:50:32
I think Devel::Unplug does at least some of what you want.
If not it can be hacked on in Copenhagen:) Re:Not sure about the name
Ovid on 2008-08-08T12:21:03
That's good to know. My intent is to have a more general purpose module (not just for development), but maybe "devel only" is a better approach.