r50671 - in /branches/upstream/libio-prompt-perl/current: Changes MANIFEST META.yml README debian/ examples/underscore.pl lib/IO/Prompt.pm t/01.dependencies.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Mon Jan 11 01:07:01 UTC 2010


Author: jawnsy-guest
Date: Mon Jan 11 01:06:45 2010
New Revision: 50671

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=50671
Log:
[svn-upgrade] Integrating new upstream version, libio-prompt-perl (0.996)

Added:
    branches/upstream/libio-prompt-perl/current/t/01.dependencies.t
Removed:
    branches/upstream/libio-prompt-perl/current/debian/
Modified:
    branches/upstream/libio-prompt-perl/current/Changes
    branches/upstream/libio-prompt-perl/current/MANIFEST
    branches/upstream/libio-prompt-perl/current/META.yml
    branches/upstream/libio-prompt-perl/current/README
    branches/upstream/libio-prompt-perl/current/examples/underscore.pl
    branches/upstream/libio-prompt-perl/current/lib/IO/Prompt.pm

Modified: branches/upstream/libio-prompt-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-prompt-perl/current/Changes?rev=50671&op=diff
==============================================================================
--- branches/upstream/libio-prompt-perl/current/Changes (original)
+++ branches/upstream/libio-prompt-perl/current/Changes Mon Jan 11 01:06:45 2010
@@ -35,3 +35,29 @@
       people who reported this oversight)
 
     - Made all underscores in flags optional
+
+
+0.99.5  Tue Sep  5 14:48:40 2006
+
+    - Fixed underscore bug in -failif and -okayif (thanks Uwe)
+
+    - Added -raw option (thanks Uwe)
+
+    - Remove spurious context attribute from return value objects
+
+    - Localized $\ within prompt() to prevent bad
+      input echoing (thanks Smylers)
+
+    - Disallowed negative exponents in -integer values (thanks Smylers)
+
+    - Documented incompatibility with systems not having /dev/tty
+      (thanks Mischa)
+
+
+0.996  Sun Jan 10 20:20:24 2010
+
+    - Added dependency check and FAQ entry for /dev/tty (thanks Miller)
+
+    - Removed spurious warning for undefined inputs
+
+    - Changed versioning system

Modified: branches/upstream/libio-prompt-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-prompt-perl/current/MANIFEST?rev=50671&op=diff
==============================================================================
--- branches/upstream/libio-prompt-perl/current/MANIFEST (original)
+++ branches/upstream/libio-prompt-perl/current/MANIFEST Mon Jan 11 01:06:45 2010
@@ -26,3 +26,4 @@
 examples/underscore.pl
 examples/while_until.pl
 examples/yesno.pl
+t/01.dependencies.t

Modified: branches/upstream/libio-prompt-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-prompt-perl/current/META.yml?rev=50671&op=diff
==============================================================================
--- branches/upstream/libio-prompt-perl/current/META.yml (original)
+++ branches/upstream/libio-prompt-perl/current/META.yml Mon Jan 11 01:06:45 2010
@@ -1,16 +1,19 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         IO-Prompt
-version:      v0.99.4
-version_from: lib/IO/Prompt.pm
-installdirs:  site
-requires:
+--- #YAML:1.0
+name:                IO-Prompt
+version:             0.996
+abstract:            Interactively prompt for user input
+license:             ~
+author:              
+    - Damian Conway <DCONWAY at cpan.org>
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
     IO::Handle:                    0
     POSIX:                         0
     Term::ReadKey:                 0
     Test::More:                    0
     version:                       0
     Want:                          0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: branches/upstream/libio-prompt-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-prompt-perl/current/README?rev=50671&op=diff
==============================================================================
--- branches/upstream/libio-prompt-perl/current/README (original)
+++ branches/upstream/libio-prompt-perl/current/README Mon Jan 11 01:06:45 2010
@@ -1,4 +1,4 @@
-IO::Prompt version 0.99.4
+IO::Prompt version 0.996
 
 By default, this module exports a single function: prompt().  It prompts the
 user to enter some input, and returns an object that represents the user input.

Modified: branches/upstream/libio-prompt-perl/current/examples/underscore.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-prompt-perl/current/examples/underscore.pl?rev=50671&op=diff
==============================================================================
--- branches/upstream/libio-prompt-perl/current/examples/underscore.pl (original)
+++ branches/upstream/libio-prompt-perl/current/examples/underscore.pl Mon Jan 11 01:06:45 2010
@@ -3,16 +3,19 @@
 # This example demostrates how prompt autosets $_ when appropriate
 
 # Case 1...
+undef $_;
 my $first = prompt "1> ";
-print defined() ? "(\$ was '$_')\n" : "(\$_ was undef)\n";
+print defined() ? "(\$_ was '$_')\n" : "(\$_ was undef)\n";
 print "Got: $first\n";
 
 # Case 2...
+undef $_;
 prompt "2> ";
-print defined() ? "(\$ was '$_')\n" : "(\$_ was undef)\n";
+print defined() ? "(\$_ was '$_')\n" : "(\$_ was undef)\n";
 print "Got: [$_]\n";
 
 # Case 3...
+undef $_;
 while (prompt "3> ") {
     print defined() ? "(\$_ was '$_')\n" : "(\$_ was undef)\n";
     print "Got: [$_]\n";
@@ -20,6 +23,7 @@
 }
 
 # Case 4...
+undef $_;
 while (my $next = prompt "4> ") {
     print defined() ? "(\$_ was '$_')\n" : "(\$_ was undef)\n";
     print "Got: $next\n";

Modified: branches/upstream/libio-prompt-perl/current/lib/IO/Prompt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-prompt-perl/current/lib/IO/Prompt.pm?rev=50671&op=diff
==============================================================================
--- branches/upstream/libio-prompt-perl/current/lib/IO/Prompt.pm (original)
+++ branches/upstream/libio-prompt-perl/current/lib/IO/Prompt.pm Mon Jan 11 01:06:45 2010
@@ -3,7 +3,7 @@
 
 package IO::Prompt;
 
-use version; $VERSION = qv('0.99.4');
+our $VERSION = '0.996';
 
 use strict;
 use Carp;
@@ -41,8 +41,8 @@
 );
 
 our %flags_alias = (
-    '-okayif' => '-while',
-    '-failif' => '-until',
+    '-okayif'  => '-while',   '-okay_if' => '-while',
+    '-failif'  => '-until',   '-fail_if' => '-until',
 );
 
 our %flags_noarg = (
@@ -50,6 +50,7 @@
     n   => 'no',
     i   => 'integer',
     num => 'number',
+    raw => 'raw_input',
     1   => 'onechar',
     c   => 'clear',
     f   => 'clearfirst',
@@ -78,14 +79,14 @@
 );
 
 my %num_pat = (
-    integer => qr{[+-]? \d+ (?:[Ee][+-]?\d+ )?}x,
+    integer => qr{[+-]? \d+ (?:[Ee]+?\d+ )?}x,
     number  => qr{[+-]? (?:\d+[.]?\d* | [.]\d+) (?:[Ee][+-]?\d+)? }x,
 );
 
 sub _get_prompt (\%@) {
     my ($flags, @data) = @_;
     my ($OUT);
-    @data = map { $flags_alias{$_} || $_ } @data;
+    @data = map { $flags_alias{$_} || defined($_) ? $_ : "" } @data;
     for (my $i = 0 ; $i < @data ; $i++) {
         local *_ = \($data[$i]);
         if (ref eq 'HASH') {
@@ -110,6 +111,9 @@
             }
             elsif (s/^-escape|-x/-/i) {
                 $flags->{-escape} = 1;
+            }
+            elsif (s/^-raw_?(?:input)?/-/i) {
+                $flags->{-raw_input} = 1;
             }
             elsif (s/^-number|-num/-/i) {
                 $flags->{-number} = 'number';
@@ -170,6 +174,8 @@
 sub prompt {
     my $caller = caller;
 
+    local $\ = q{};   # Make sure no funny business on print statements
+
     my %flags;
     my ($OUT, @prompt) = _get_prompt(%flags, @_);
     open $OUT, ">/dev/tty" or croak "Cannot write to terminal: $!" if !$OUT;
@@ -230,33 +236,34 @@
       && (!$flags{ -while } || $input =~ $flags{ -while })
       && (!$flags{ -until } || $input !~ $flags{ -until });
     print {$RECORD} $input, "\n" if $success && $RECORD;
+    return "$input" if $flags{-raw_input};
     return bless {
         value   => $input,
         success => $success,
         set_val => $flags{ -set_underscore },
-        context => (caller(1))[2],
       },
       'IO::Prompt::ReturnVal';
 }
 
 sub _success {
-    my ($val, $no_set) = @_;
+    my ($val, $no_set, $raw) = @_;
     print {$RECORD} $val, "\n" if $val && $RECORD;
+    return "$val" if $raw;
     return bless {
         value   => $val,
         success => 1,
         set_val => !$no_set,
-        context => (caller(1))[2],
       },
       'IO::Prompt::ReturnVal';
 }
 
 sub _failure {
+    my ($val, $raw) = @_;
+    return "$val" if $raw;
     return bless {
-        value   => $_[0],
+        value   => $val,
         success => 0,
         set_val => 0,
-        context => (caller(1))[2],
       },
       'IO::Prompt::ReturnVal';
 }
@@ -475,17 +482,16 @@
         $yesprompt && $noprompt ? "'$yesprompt' or '$noprompt'"
       : $yesprompt ? "'$yesprompt' for yes"
       : "'$noprompt' for no";
+    my $raw = $flags->{-raw_input};
     print {$OUT} @prompt if -t $IN;
     while (1) {
         my $response =
           get_input($IN, $OUT, { %$flags, -nlstr => "" }, @prompt);
         chomp $response unless $flags->{-line};
-        print {$OUT} "\n" and return _success($response, 'no_set')
-          if defined $response
-          and $response =~ /$yes/;
-        print {$OUT} "\n" and return _failure($response)
-          if !defined $response
-          or $response =~ /$no/;
+        print {$OUT} "\n" and return _success($response, 'no_set', $raw)
+            if defined $response and $response =~ /$yes/;
+        print {$OUT} "\n" and return _failure($response, $raw)
+          if !defined $response or $response =~ /$no/;
         print {$OUT} "\r", " " x 79, "\r", @prompt,
           "(Please answer $prompt2) "
           if -t $IN;
@@ -631,7 +637,7 @@
 
 =head1 VERSION
 
-This document describes IO::Prompt version 0.99.4
+This document describes IO::Prompt version 0.996
 
 =head1 SYNOPSIS
 
@@ -695,10 +701,10 @@
                                      - Hashes must return true for input as key
 
  -u     -until         <str|rgx>    Fail if input matches <str|regex>
- -u     -fail_if       <str|rgx>    Fail if input matches <str|regex>
+        -fail_if               
 
  -w     -while         <str|rgx>    Fail unless input matches <str|regex>
- -w     -okay_if       <str|rgx>    Fail unless input matches <str|regex>
+        -okay_if       
 
  -m     -menu          <list|hash>  Show the data specified as a menu 
                                     and allow one to be selected. Enter
@@ -707,6 +713,9 @@
  -1     -one_char                   Return immediately after first char typed
 
  -x     -escape                     Pressing <ESC> returns "\e" immediately
+
+ -raw   -raw_input                  Return only the string that was input
+                                    (turns off context-sensitive features)
 
  -c     -clear                      Clear screen before prompt
  -f     -clear_first                Clear screen before first prompt only
@@ -841,7 +850,8 @@
 
 =head1 INCOMPATIBILITIES
 
-None reported.
+The module requires a /dev/tty device be available. It is therefore
+incompatible with any system that doesn't provide such a device.
 
 
 =head1 BUGS AND LIMITATIONS
@@ -851,6 +861,22 @@
 Please report any bugs or feature requests to
 C<bug-io-prompt at rt.cpan.org>, or through the web interface at
 L<http://rt.cpan.org>.
+
+
+=head1 FAQ
+
+This is a collection of things that might help.  Please send your
+questions that are not answered here to Damian Conway
+C<< <DCONWAY at cpan.org> >>
+
+=head2 Can I use this module with ActivePerl on Windows?
+
+Up to now, the answer was 'No', but this has changed.
+
+You still cannot use ActivePerl, but if you use the Cygwin environment
+(http://sources.redhat.com), which brings its own perl, and have
+the latest IO::Tty (v0.05 or later) installed, it should work (feedback
+appreciated). 
 
 
 =head1 THANKS

Added: branches/upstream/libio-prompt-perl/current/t/01.dependencies.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-prompt-perl/current/t/01.dependencies.t?rev=50671&op=file
==============================================================================
--- branches/upstream/libio-prompt-perl/current/t/01.dependencies.t (added)
+++ branches/upstream/libio-prompt-perl/current/t/01.dependencies.t Mon Jan 11 01:06:45 2010
@@ -1,0 +1,5 @@
+use Test::More tests => 2;
+
+# Depends on hardcoded /dev/tty access
+ok( open(my $OUT, ">/dev/tty"), "Output to /dev/tty");
+ok( open(my $IN, "</dev/tty"), "Input from /dev/tty");




More information about the Pkg-perl-cvs-commits mailing list