I just got an email from a smoke tester reporting "Can't locate File/Util.pm in @INC". Details here:
Date: Fri, 6 Jun 2008 17:20:12 +0100
Subject: FAIL Test-MonitorSites-0.13 darwin-2level 7.9.0
From: "JJ" <jj@jonallen.info>
To: cpan-testers@perl.org
Cc: HESCO@cpan.org
X-Reported-Via: Test::Reporter 1.4001, via CPAN::Reporter 1.15
<snip>
------------------------------
PROGRAM OUTPUT
------------------------------
Output from '/Users/jj/perl/perl-5.8.1/bin/perl Makefile.PL':
Can't locate File/Util.pm in @INC (@INC contains: /Users/jj/perl/perl-
+5.8.1/lib/5.8.1/darwin-2level /Users/jj/perl/perl-5.8.1/lib/5.8.1 /Us
+ers/jj/perl/pe
rl-5.8.1/lib/site_perl/5.8.1/darwin-2level /Users/jj/perl/perl-5.8.1/l
+ib/site_perl/5.8.1 /Users/jj/perl/perl-5.8.1/lib/site_perl .) at Make
+file.PL line 4
.
BEGIN failed--compilation aborted at Makefile.PL line 4.
------------------------------
PREREQUISITES
------------------------------
Prerequisite modules loaded:
No requirements found
however, the Makefile.PL for that module includes File::Util included in the PREREQ_PM hash, but also a
use File::Util, plus some code which uses that module, prior to running the WriteMakefile() function to handle pre-requisites. It reads:
use strict;
use warnings;
use ExtUtils::MakeMaker;
use File::Util;
print "==> These tests generate email output
+ <==\n";
print "==> Where would you like your test results sent?
+ <==\n";
print "==> By default test email summaries go to dev-null\@example.co
+m <==\n";
print "==> By default test sms summaries go to dev-null\@example.com
+ <==\n";
my $email = prompt('Send test email summaries to?','devnull@example.co
+m');
my $sms = prompt('Send test sms summaries to?','devnull@example.com');
my($f) = File::Util->new();
my @config_files = $f->list_dir( 't/ini' , '--pattern=\.ini$' );
foreach my $config_file (@config_files){
print "writing t/$config_file \n";
open ('INI','>',"t/$config_file");
open ('SRC',"t/ini/$config_file");
while(<SRC>){
if(m/^sms_recipients =/){ $_ =~ s/$_/sms_recipients = '$sms'\n/; }
if(m/^results_recipients =/){ $_ =~ s/$_/results_recipients = '$em
+ail'\n/; }
print INI $_;
}
close SRC;
close INI;
}
WriteMakefile(
NAME => 'Test::MonitorSites',
AUTHOR => 'Hugh Esco <hesco@greens.org>',
VERSION_FROM => 'lib/Test/MonitorSites.pm',
ABSTRACT_FROM => 'lib/Test/MonitorSites.pm',
PL_FILES => {},
PREREQ_PM => {
'Cwd' => 0,
'Carp' => 0,
'File::Util' => 0,
'Data::Dumper' => 0,
'Test::More' => 0,
'Test::Pod' => 1.14,
'Test::Pod::Coverage' => 1.04,
'Test::Builder' => 0,
'Mail::Mailer' => 0,
'Config::Simple' => 0,
'WWW::Mechanize' => 0,
'Test::WWW::Mechanize' => 0,
'Test::HTML::Tidy' => 0,
'HTTP::Request::Common' => 0,
'Test::Builder::Tester' => 0,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }
+,
clean => { FILES => 'Test-MonitorSites-* t/*.ini' },
);
I would assume that the failure is the result of my attempt to use and instantiate an object from File::Util, before I ran the WriteMakeFile() method over my list of PREREQ_PM's. Is there some way to switch things around and still have this all work? If I move the File::Util code below the WriteMakefile() invocation, would it benefit from PREREQ_PM installations? Would using a require later in the code, instead of a use at the top of the script make the difference here?
Does the cpan prompt have some way of uninstalling a module so I could test this on my local sandbox, without having to just guess at things and hope that this change does what I intend without breaking something else?
UPDATE:
My File::Util dependency is limited to this single invocation in Makefile.PL,
my($f) = File::Util->new();
my @config_files = $f->list_dir( 't/ini' , '--pattern=\.ini$' );
foreach my $config_file (@config_files){
which rewrites some configuration files so that the tests send sample output to the installers email and sms addresses. I'm about to commit version 0.15 of this module using Syphillis' idea. But I'm guessing its time to reach for TIMTOWTDI for this simple task.
-- Hugh
if( $lal && $lol ) { $life++; }