Subject: | Use prompt() in configure.pl to Allow Automated Tests |
Dear Don Shanks,
Hi. This is imacat from Taiwan. I'm currently helping to run smoke
tests for CPAN modules. I found that the configure.pl of bbobj-0.5.1
goes into infinite loop if nothing is read from keyboard. I would
suggest that you use prompt() instead of directly obtain input from the
STDIN, as suggested in the ExtUtils::MakeMaker document, so that the it
won't go into infinite loop.
<<ExtUtils::MakeMaker>>
Other Handy Functions
http://search.cpan.org/perldoc?ExtUtils::MakeMaker#Other_Handy_Functions
Also, I would suggest you to exit() instead of die() from the
Makefile.PL if configure.pl fails, as suggested by this article:
<<Notes For CPAN Authors>
"How can I stop getting FAIL reports for missing libraries or other
non-Perl dependencies?"
http://cpantest.grango.org/wiki/CPANAuthorNotes
I made a simple patch to bbobj-0.5.1, in the hope that it helps.
Please tell me if you have any question, or if I could be of any help.
Thank you.
Subject: | bbobj-0.5.1-prompt.diff |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
diff -u -r bbobj-0.5.1.orig/configure.pl bbobj-0.5.1/configure.pl
- --- bbobj-0.5.1.orig/configure.pl 2002-07-14 14:43:06.000000000 +0800
+++ bbobj-0.5.1/configure.pl 2008-03-27 23:28:55.000000000 +0800
@@ -2,6 +2,7 @@
## $Id: configure.pl,v 1.2 2002/07/14 06:43:06 dshanks Exp $
+use ExtUtils::MakeMaker;
use File::Copy;
my $line;
@@ -10,8 +11,7 @@
my $bbuser = $ENV{'USER'} || 'bbuser';
## request the user id for the BigBrother user
- -print "Big Brother User: [$bbuser] ";
- -while ( not defined ( $line = readline(STDIN) ) ) { }
+$line = prompt("Big Brother User: ", $bbuser);
chomp $line;
if ($line) { $bbuser = $line; }
@@ -19,8 +19,7 @@
my $bbhome = $opts->{'d'} || "/home/$bbuser/bb";
## request the user id for the BigBrother home directory
- -print "Big Brother Home Directory: [$bbhome] ";
- -while ( not defined ( $line = readline(STDIN) ) ) { }
+$line = prompt("Big Brother Home Directory: ", $bbhome);
chomp $line;
if ($line) { $bbhome = $line; }
diff -u -r bbobj-0.5.1.orig/Makefile.PL bbobj-0.5.1/Makefile.PL
- --- bbobj-0.5.1.orig/Makefile.PL 2002-07-26 10:29:29.000000000 +0800
+++ bbobj-0.5.1/Makefile.PL 2008-03-27 23:29:34.000000000 +0800
@@ -5,7 +5,8 @@
# If the configure script returns an error
if ( $resultstat != 0 ) {
- - die "EXITSTAT: $resultstat \n";
+ print "EXITSTAT: $resultstat \n";
+ exit 0;
}
WriteMakefile(
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (GNU/Linux)
iEYEARECAAYFAkfrvZoACgkQi9gubzC5S1x56ACgqnTL3HrZRNS/T0+fnzkGnXMB
BIoAniAK6jcdPH9jfbaP8p1TnwpZRY+J
=MCic
-----END PGP SIGNATURE-----