[Bps-public-commit] r16196 - Prophet/trunk/lib/Prophet/CLI

ruz at bestpractical.com ruz at bestpractical.com
Thu Oct 2 11:48:58 EDT 2008


Author: ruz
Date: Thu Oct  2 11:48:58 2008
New Revision: 16196

Modified:
   Prophet/trunk/lib/Prophet/CLI/Command.pm

Log:
* move prompt_Yn method out of SD into Prophet

Modified: Prophet/trunk/lib/Prophet/CLI/Command.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command.pm	Thu Oct  2 11:48:58 2008
@@ -169,6 +169,26 @@
     return \%props;
 }
 
+=head2 prompt_Yn question
+
+Asks user the question and returns true if answer was positive or false otherwise.
+Default answer is 'Yes'.
+
+=cut
+
+sub prompt_Yn {
+    my $self = shift;
+    my $msg = shift;
+    print "$msg [Y/n]: ";
+
+    my $a = <>;
+    chomp $a;
+
+    return 1 if $a =~ /^(|y|yes)$/i;
+    return 0;
+}
+
+
 __PACKAGE__->meta->make_immutable;
 no Moose;
 



More information about the Bps-public-commit mailing list