Skip Menu |

This queue is for tickets about the Module-Info CPAN distribution.

Report information
The Basics
Id: 11564
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Module-Info

People
Owner: Nobody in particular
Requestors: bzm [...] 2bz.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: new_from_loaded returns something, even if the requested mod does not exists
Hi, Module::Info -> new_from_loaded('I_do_not_exist'); returns sonething even if the requested module does not exist. A patch with testcase attached against Module-Info-0.26.
=== lib/Module/Info.pm ================================================================== --- lib/Module/Info.pm (revision 461) +++ lib/Module/Info.pm (local) @@ -122,7 +122,7 @@ my $mod_file = join('/', split('::', $name)) . '.pm'; my $filepath = $INC{$mod_file} || ''; - my $module = Module::Info->new_from_file($filepath); + my $module = Module::Info->new_from_file($filepath) or return; $module->{name} = $name; ($module->{dir} = $filepath) =~ s|/?\Q$mod_file\E$||; $module->{dir} = File::Spec->rel2abs($module->{dir}); === t/Module-Info.t ================================================================== --- t/Module-Info.t (revision 461) +++ t/Module-Info.t (local) @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use lib qw(t/lib); -use Test::More tests => 58; +use Test::More tests => 59; use Config; my $Mod_Info_VERSION = '0.26'; @@ -142,6 +142,8 @@ " they're all Module::Info objects" ); +$mod_info = Module::Info->new_from_loaded('this_module_does_not_exist'); +is( $mod_info, undef, 'new_from_loaded' ); SKIP: { skip "Only works on 5.6.1 and up.", 17 unless $] >= 5.006001;
Thanks, applied! Module::Info 0.27 uploaded to CPAN. Regards Mattia