From c2d71e2a8243638dea4654e2eff8f2a61e504091 Mon Sep 17 00:00:00 2001
From: Guilhem Moulin <guilhem.moulin@ens-lyon.org>
Date: Thu, 1 Mar 2012 18:47:04 +0100
Subject: question

---
 videoadd.pl | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/videoadd.pl b/videoadd.pl
index bf1a224..a6b0ed3 100755
--- a/videoadd.pl
+++ b/videoadd.pl
@@ -304,7 +304,9 @@ if ( defined ($imdb{crit}) and &runIMDb() ) {
             for (my $i=0; $i<72; $i++) {print '=' or die "Can't print: $!"};
             print "\n" or die "Can't print: $!";
     
-            $imdb{crit} = &ask ( \@options, "Choose an ID above:", $options[0] );
+            $imdb{crit} = &question ( \@options,
+                                      "Choose an IMDb ID above, to retrieve data from:",
+                                      $options[0] );
         }
         else {
             $single = 1;
@@ -534,7 +536,7 @@ if ( defined ($file) and defined ($move_flag) ) {
         my $dir = catdir ( $directors, $new{director} );
         unless (-d $dir) {
             print STDERR "Directory `$dir' does not exist. ";
-            my $answer = &askYN( "Should I create it?", 'y' );
+            my $answer = &YNquestion( "Should I create it?", 'y' );
             if ($answer eq 'y') {
                 mkdir $dir or die "Error: Cannot mkdir `$dir': $!\n";
             }
@@ -670,7 +672,7 @@ sub getfile {
             for (my $i=0; $i<72; $i++) {print '=' or die "Can't print: $!"};
             print "\n" or die "Can't print: $!";
     
-            $answer = &ask ( \@options, "Choose an ID above:", $options[0] );
+            $answer = &question ( \@options, "Choose an ID above to update:", $options[0] );
         }
         
         $answer =~ s/^0+//;
@@ -751,7 +753,7 @@ sub runMplayer {
 }
 
 # Ask a question interactively
-sub ask {
+sub question {
     my ($options, $question, $default, $pdefault) = @_;
     my $answer;
 
@@ -775,10 +777,12 @@ sub ask {
    return $answer;
 }
 
-# Ask a Yes/No question
-sub askYN {
+# Yes/No question
+sub YNquestion {
     my ($question, $default) = @_;
+
     my $pdefault = "Y/n";
     $pdefault = "y/N" if $default eq 'n';
-    return &ask ( ['y','n'], $question, $default, $pdefault );
+
+    return &question ( ['y','n'], $question, $default, $pdefault );
 }
-- 
cgit v1.2.3