Subject: | When use-d in other module, CPAN::Mini throws warnings and leads to test failures |
Ricardo,
Recently I uploaded to CPAN a new distribution called
CPAN-Mini-Visit-Simple
(http://search.cpan.org/~jkeenan/CPAN-Mini-Visit-Simple-0.002/). As
you might suspect, it calls 'use CPAN::Mini'. I very quickly got back
several reports from automated CPAN testers indicating that my tests
were massively failing. See, for example,
http://www.cpantesters.org/cpan/report/6892549. Here's an excerpt:
PERL_DL_NONLAZY=1 /usr/perl5.10.1/bin/perl "-MExtUtils::Command::MM"
"-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
Use of uninitialized value $config_file in concatenation (.) or string
at /usr/perl5.10.1/lib/site_perl/5.10.1/CPAN/Mini.pm line 428.
Use of uninitialized value $config_file in open at
/usr/perl5.10.1/lib/site_perl/5.10.1/CPAN/Mini.pm line 430.
Use of uninitialized value $config_file in concatenation (.) or string
at /usr/perl5.10.1/lib/site_perl/5.10.1/CPAN/Mini.pm line 430.
couldn't open config file : No such file or directory at
/usr/perl5.10.1/lib/site_perl/5.10.1/CPAN/Mini.pm line 430.
# Looks like you planned 13 tests but ran 1.
# Looks like your test exited with 2 just after 1.
t/001_new.t .......................
On the box on which I developed my distro, I have version 0.576 of
CPAN::Mini installed. Searching in lib/CPAN/Mini/Visit/Simple.pm, I see
in read_config():
613 sub read_config {
614 my ($class) = @_;
615
616 my $filename = File::Spec->catfile($class->__homedir,
'.minicpanrc');
617
618 $filename = $class->__default_configfile unless -e $filename;
619 return unless -e $filename;
620
621 open my $config_file, '<', $filename
622 or die "couldn't open config file $filename: $!";
623
I presume that '$filename' is the uninitialized value in question; that
would explain the whitespace immediately before the ':' in the 'couldn't
open config file' error message above.
But how could $filename be uninitialized in lines 621-22. The file
itself had to have existed to get past line 619!
Is there something I'm not getting here?
Thank you very much.
Jim Keenan
Info:
perl -v
This is perl, v5.10.1 (*) built for darwin-2level