Re: LWPng-alpha-0.11
Andreas J. Koenig (koenig@kulturbox.de)
27 Mar 1998 18:35:35 +0100
>>>>> On 27 Mar 1998 11:19:29 +0100, Gisle Aas <gisle@aas.no> said:
gisle> Is there already some Perl module that allow me to check if some
gisle> module, for instance 'Compress::Zlib', is available without actually
gisle> trying to load it?
With File::Spec it should be a breeze (untested, modified code from CPAN.pm):
sub module_available ($) {
my($mod) = @_;
my($dir,@packpath);
@packpath = split /::/, $mod;
$packpath[-1] .= ".pm";
foreach $dir (@INC) {
my $pmfile = File::Spec->catfile($dir,@packpath);
if (-f $pmfile){
return $pmfile;
}
}
return;
}
--
andreas