Subject: | Use prompt() in write_driver_info.pl to Allow Automated Tests |
Dear Jean-Michel Hiver,
Hi. This is imacat from Taiwan. I'm currently helping to run smoke
tests for CPAN modules. I found that when doing "make", the
write_driver_info.pl of TripleStore-0.03 goes into infinite loop if
nothing is read from keyboard. I would suggest that you use prompt()
from ExtUtils::MakeMaker in your write_driver_info.pl, 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 TripleStore-0.03, 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: | TripleStore-0.03-prompt.diff |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
diff -u -r TripleStore-0.03.orig/write_driver_info.pl TripleStore-0.03/write_driver_info.pl
- --- TripleStore-0.03.orig/write_driver_info.pl 2003-01-21 22:35:01.000000000 +0800
+++ TripleStore-0.03/write_driver_info.pl 2008-03-30 00:44:49.000000000 +0800
@@ -1,6 +1,6 @@
use strict;
use warnings;
- -
+use ExtUtils::MakeMaker;
while (1)
{
@@ -12,32 +12,17 @@
sub make_choice
{
- - print "\n\n";
- - print "Choose which driver to test\n";
- - print "[1] MySQL\n";
- - print "[2] Skip Tests\n";
- - my $choice = <STDIN>;
- - chomp ($choice);
- - return $choice;
+ return prompt("\n\nChoose which driver to test\n[1] MySQL\n[2] Skip Tests\n", 2);
}
sub mysql
{
- - print "DSN String ['DBI:mysql:database=test']: ";
- - my $dsn = <STDIN>;
- - chomp ($dsn);
- - $dsn = 'DBI:mysql:database=test' unless ($dsn);
- -
- - print "User ['root']: ";
- - my $user = <STDIN>;
- - chomp ($user);
- - $user = 'root' unless ($user);
- -
- - print "Password [undef]: ";
- - my $pass = <STDIN>;
- - chomp ($pass);
- - $pass = '' unless ($user);
+ my $dsn = prompt("DSN String: ", "DBI:mysql:database=test");
+
+ my $user = prompt("User: ", "root");
+
+ my $pass = prompt("Password: ", "");
print "Writing driver info... ";
open FP, ">t/driver.nfo" or die "Cannot write-open t/driver.nfo. Reason: $!";
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkfuchEACgkQi9gubzC5S1z05QCfVW65PganweD4NV0ILJ1YwcPt
6rYAnRYV4c+cImYLEshpUebH3sg9bgpT
=gs9h
-----END PGP SIGNATURE-----