Subject: | Use prompt() in Makefile.PL to Allow Automated Tests |
Dear Richard Kilgore,
Hi. This is imacat from Taiwan. I'm currently helping to run smoke
tests for CPAN modules. I found that the Makefile.PL of
Speech-Recognizer-ViaVoice-0.02 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
the required IBM ViaVoice 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 Speech-Recognizer-ViaVoice-0.02, 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: | Speech-Recognizer-ViaVoice-0.02-prompt.diff |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
diff -u -r Speech-Recognizer-ViaVoice-0.02.orig/Makefile.PL Speech-Recognizer-ViaVoice-0.02/Makefile.PL
- --- Speech-Recognizer-ViaVoice-0.02.orig/Makefile.PL 2001-11-08 15:07:03.000000000 +0800
+++ Speech-Recognizer-ViaVoice-0.02/Makefile.PL 2008-03-30 03:26:31.000000000 +0800
@@ -52,22 +52,20 @@
printSeparator;
my ($bOk, $vvDir) = (0, undef);
while (0 == $bOk) {
- - $vvDir = $defaultVVDir;
- - printf "Please enter your ViaVoice installation directory,\n"
+ $vvDir = prompt("Please enter your ViaVoice installation directory,\n"
. "or press RETURN to accept the default.\n\n"
- - . "ViaVoice directory [ %s ]: ", $vvDir;
- - chop(my $s = <STDIN>);
- - if (not ($s =~ m/^\s*$/)) {
- - $vvDir = $s;
- - }
+ . "ViaVoice directory:", $defaultVVDir);
if (verifyVVDir($vvDir)) {
$bOk = 1;
} else {
- - printf "\n%s does not contain an insallation that I\n"
+ $s = prompt(sprintf("\n%s does not contain an insallation that I\n"
. "recognize. If you wish to proceed with this setting, you might\n"
. "need to do some trouble-shooting.\n\n"
- - . "Proceed (y/N)? : ", $vvDir;
- - chop($s = <STDIN>);
+ . "Proceed (y/N)?", $vvDir));
+ if (!$s) {
+ print "Cannot continue\n";
+ exit 0;
+ }
if ($s =~ m/\s*(?:y(?:es)?)\s*/i) {
$bOk = 1;
} else {
@@ -85,18 +83,11 @@
. "installation containing %s/vocabs/langs/%s)\n\n", $vvDir, $defaultLocale, $vvDir, $defaultLocale;
$bOk = 0;
while (0 == $bOk) {
- - $locale = $defaultLocale;
- - printf "Enter your locale [ %s ]: ", $locale;
- -
- - chop(my $s = <STDIN>);
- - if (not $s =~ m/^\s*$/) {
- - $locale = $s;
- - }
+ $locale = prompt("Enter your locale: ", $defaultLocale);
if (not verifyVVDir($vvDir) or (-d "$vvDir/vocabs/langs/$locale")) {
$bOk = 1;
} else {
- - printf "\n%s/vocabs/langs/%s does not exist. Proceed (y/N)? : ", $vvDir, $locale;
- - chop($s = <STDIN>);
+ $s = prompt(sprintf("\n%s/vocabs/langs/%s does not exist. Proceed (y/N)? : ", $vvDir, $locale));
if ($s =~ m/\s*(?:y(?:es)?)\s*/i) {
$bOk = 1;
} else {
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkfumBcACgkQi9gubzC5S1y1PgCgkTTz//jGA3inAf8oVG0Hsp0x
iekAn1xPeJgIUURQLkZZ+R2rqdkdbd1b
=x2RD
-----END PGP SIGNATURE-----