Subject: | Use prompt() in Makefile.PL to Allow Automated Tests |
Dear Lupe Christoph,
Hi. This is imacat from Taiwan. I'm currently helping to run smoke
tests for CPAN modules. I found that the Makefile.PL of
Filesys-SamFS-0.035 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() with 0 from the Makefile.PL if
SamFS 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 Filesys-SamFS-0.035, 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: | Filesys-SamFS-0.035-prompt.diff |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
diff -u -r Filesys-SamFS-0.035.orig/Makefile.PL Filesys-SamFS-0.035/Makefile.PL
- --- Filesys-SamFS-0.035.orig/Makefile.PL 2000-02-23 17:46:00.000000000 +0800
+++ Filesys-SamFS-0.035/Makefile.PL 2008-03-30 01:23:56.000000000 +0800
@@ -32,9 +32,12 @@
$SamFS_dir = '/opt/LSCsamfs';
do {{
- - print "Where is SamFS located [$SamFS_dir]: ";
- - $answer = <STDIN>;
- - chomp $answer;
+ $answer = prompt("Where is SamFS located [$SamFS_dir]: ");
+ unless (length($answer)
+ && (-d $SamFS_dir && "$SamFS_dir/include" && "$SamFS_dir/lib")) {
+ print "Sorry, you must specify the SamFS location.\n";
+ exit 0;
+ }
$answer = $SamFS_dir unless length($answer);
unless (-d $answer) {
print "Sorry, but $answer is not a directory. Please try again.\n";
@@ -54,10 +57,7 @@
print "\n";
do {{
- - print "A directory in a SamFS filesystem writable by this user [$dir]: ";
- - $answer = <STDIN>;
- - chomp $answer;
- - $answer = $dir unless length($answer);
+ $answer = prompt("A directory in a SamFS filesystem writable by this user [$dir]: ");
unless (length($answer)) {
print "Sorry, but you have to provide an answer. There is no default.\n";
next;
@@ -76,10 +76,7 @@
print "\n";
do {{
- - print "The equipment ordinal of a tape drive or MO drive [$eq]: ";
- - $answer = <STDIN>;
- - chomp $answer;
- - $answer = $eq unless length($answer);
+ $answer = prompt("The equipment ordinal of a tape drive or MO drive [$eq]: ");
unless (length($answer)) {
print "Sorry, but you have to provide an answer. There is no default.\n";
next;
@@ -94,9 +91,7 @@
$catalog = '/etc/fs/samfs/sam_historian' unless defined $catalog;
do {{
- - print "The location of a catalog file [$catalog]: ";
- - $answer = <STDIN>;
- - chomp $answer;
+ $answer = prompt("The location of a catalog file [$catalog]: ");
$answer = $catalog unless length($answer);
unless (-e $answer) {
print "Sorry, but $answer does not exist. Please try again.\n";
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkfue0cACgkQi9gubzC5S1yoPwCfb1GemCNy7l+acN7ZOy0xCxfl
c6UAoJiXaNZGKPcrGQu2lzqlAsaRJLXk
=HRqz
-----END PGP SIGNATURE-----