Subject: | Use prompt() in installwebfiles.PL to Allow Automated Tests |
Dear Leo Charre,
Hi. This is imacat from Taiwan. I found that the
installwebfiles.PL of WWW-Autosite-1.08 goes into infinite loop if
nothing is read from keyboard. I would suggest that you use prompt()
from ExtUtils::MakeMaker 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
I made a simple patch to WWW-Autosite-1.08, 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: | WWW-Autosite-1.08-prompt.diff |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
diff -u -r WWW-Autosite-1.08.orig/installwebfiles.PL WWW-Autosite-1.08/installwebfiles.PL
- --- WWW-Autosite-1.08.orig/installwebfiles.PL 2007-03-05 23:32:00.000000000 +0800
+++ WWW-Autosite-1.08/installwebfiles.PL 2008-04-16 01:35:16.000000000 +0800
@@ -3,6 +3,7 @@
use strict;
use File::Copy;
use File::Path;
+use ExtUtils::MakeMaker
my $VERSION = '0.1';
my $overwrite = 0;
@@ -27,7 +28,7 @@
my $action = ioyn('Would you like to go ahead and install the web files?') or exit;
if ($action ==2){ $overwrite =1;}
- -$ENV{HOME} = iopath("Your web account HOME dir? (/home/xxx)?", "$ENV{HOME}");
+$ENV{HOME} = prompt("Your web account HOME dir?", $ENV{HOME});
my @manifest;
@@ -80,9 +81,7 @@
my $val = undef;
until (defined $val){
- - print $question . ' (y/n/a): ';
- - $val = <STDIN>;
- - chomp $val;
+ $val = prompt($question . ' (y/n/a):', 'n');
if ($val eq 'y'){ $val = 1; }
elsif ($val eq 'n'){ $val = 0;}
elsif ($val eq 'a'){ $val = 2;}
@@ -92,44 +91,6 @@
}
- -
- -
- -
- -
- -
- -sub iopath {
- - my $question = shift;
- - my $predetermined = shift;
- - my $val = undef;
- -
- - until ($val){
- - if ($predetermined){
- - print "$question [$predetermined]: ";
- - }
- - else {
- - print "$question []: ";
- - }
- -
- - $val = <STDIN>;
- - if ($val eq "\n" and $predetermined){
- - $val = $predetermined;
- - }
- -
- - chomp $val;
- - unless (-d $val){
- - print "That is not a directory on this machine";
- -
- - $val = undef;
- -
- -
- - }
- -
- -
- - }
- - return $val;
- -}
- -
- -
=pod
=head1 NAME
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkgE54AACgkQi9gubzC5S1zlswCghT1/14TzUejpmw7smklGYfU9
v3cAnjM5irRAZMmPQ7zAQWaaPPRa6p/M
=6oFp
-----END PGP SIGNATURE-----