r50676 - in /trunk/libio-prompt-perl: Changes MANIFEST META.yml README debian/changelog debian/compat debian/control debian/rules 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:51:40 UTC 2010
Author: jawnsy-guest
Date: Mon Jan 11 01:51:33 2010
New Revision: 50676
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=50676
Log:
* New upstream release
* Use new debhelper 7 short rules format
* Add myself to Uploaders and Copyright
* Standards-Version 3.8.3 (no changes)
* Rewrite control description
* Update dependency alternatives (some things are core)
Added:
trunk/libio-prompt-perl/t/01.dependencies.t
- copied unchanged from r50672, branches/upstream/libio-prompt-perl/current/t/01.dependencies.t
Modified:
trunk/libio-prompt-perl/Changes
trunk/libio-prompt-perl/MANIFEST
trunk/libio-prompt-perl/META.yml
trunk/libio-prompt-perl/README
trunk/libio-prompt-perl/debian/changelog
trunk/libio-prompt-perl/debian/compat
trunk/libio-prompt-perl/debian/control
trunk/libio-prompt-perl/debian/rules
trunk/libio-prompt-perl/examples/underscore.pl
trunk/libio-prompt-perl/lib/IO/Prompt.pm
Modified: trunk/libio-prompt-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/Changes?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/Changes (original)
+++ trunk/libio-prompt-perl/Changes Mon Jan 11 01:51:33 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: trunk/libio-prompt-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/MANIFEST?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/MANIFEST (original)
+++ trunk/libio-prompt-perl/MANIFEST Mon Jan 11 01:51:33 2010
@@ -26,3 +26,4 @@
examples/underscore.pl
examples/while_until.pl
examples/yesno.pl
+t/01.dependencies.t
Modified: trunk/libio-prompt-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/META.yml?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/META.yml (original)
+++ trunk/libio-prompt-perl/META.yml Mon Jan 11 01:51:33 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: trunk/libio-prompt-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/README?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/README (original)
+++ trunk/libio-prompt-perl/README Mon Jan 11 01:51:33 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: trunk/libio-prompt-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/debian/changelog?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/debian/changelog (original)
+++ trunk/libio-prompt-perl/debian/changelog Mon Jan 11 01:51:33 2010
@@ -1,4 +1,12 @@
-libio-prompt-perl (0.99.4-4) UNRELEASED; urgency=low
+libio-prompt-perl (0.996-1) UNRELEASED; urgency=low
+
+ [ Jonathan Yu ]
+ * New upstream release
+ * Use new debhelper 7 short rules format
+ * Add myself to Uploaders and Copyright
+ * Standards-Version 3.8.3 (no changes)
+ * Rewrite control description
+ * Update dependency alternatives (some things are core)
[ gregor herrmann ]
* debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
@@ -17,7 +25,7 @@
[ Nathan Handler ]
* debian/watch: Update to ignore development releases.
- -- gregor herrmann <gregor+debian at comodo.priv.at> Tue, 09 Oct 2007 22:29:53 +0200
+ -- Jonathan Yu <jawnsy at cpan.org> Sun, 10 Jan 2010 20:13:19 -0500
libio-prompt-perl (0.99.4-3) unstable; urgency=medium
Modified: trunk/libio-prompt-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/debian/compat?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/debian/compat (original)
+++ trunk/libio-prompt-perl/debian/compat Mon Jan 11 01:51:33 2010
@@ -1,1 +1,1 @@
-5
+7
Modified: trunk/libio-prompt-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/debian/control?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/debian/control (original)
+++ trunk/libio-prompt-perl/debian/control Mon Jan 11 01:51:33 2010
@@ -1,26 +1,22 @@
Source: libio-prompt-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 5), libmodule-build-perl
-Build-Depends-Indep: perl, libversion-perl, libterm-readkey-perl, libwant-perl, libtest-pod-perl, libtest-pod-coverage-perl
+Build-Depends: debhelper (>= 7), perl (>= 5.10) | libmodule-build-perl
+Build-Depends-Indep: perl, perl (>= 5.10) | libversion-perl, libtest-pod-perl,
+ libterm-readkey-perl, libwant-perl, libtest-pod-coverage-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: gregor herrmann <gregoa at debian.org>, Gunnar Wolf <gwolf at debian.org>, Niko Tyni <ntyni at iki.fi>
-Standards-Version: 3.8.0
+Uploaders: gregor herrmann <gregoa at debian.org>, Jonathan Yu <jawnsy at cpan.org>,
+ Gunnar Wolf <gwolf at debian.org>, Niko Tyni <ntyni at iki.fi>
+Standards-Version: 3.8.3
Homepage: http://search.cpan.org/dist/IO-Prompt/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libio-prompt-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libio-prompt-perl/
Package: libio-prompt-perl
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libversion-perl, libterm-readkey-perl, libwant-perl
-Description: Interactively prompt for user input
- 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.
- .
- You may specify various flags to the function to affect its behaviour; most
- notably, it defaults to automatically chomp the input, unless the -line
- flag is specified.
- .
- Two other functions are exported at request: hand_print, which simulates
- hand-typing to the console; and get_input, which is the lower-level function
- that actually prompts the user for a suitable input.
+Depends: ${perl:Depends}, ${misc:Depends}, perl (>= 5.10) | libversion-perl,
+ libterm-readkey-perl, libwant-perl
+Description: module to interactively prompt for user input
+ IO::Prompt is a Perl module useful for prompting the user for some input and
+ returning that data as an object. It also provides functions for simulating
+ hand-typing to the console and for accessing the low-level input.
Modified: trunk/libio-prompt-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/debian/rules?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/debian/rules (original)
+++ trunk/libio-prompt-perl/debian/rules Mon Jan 11 01:51:33 2010
@@ -1,62 +1,4 @@
#!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
-#
-# It was later modified by Jason Kohles <email at jasonkohles.com>
-# http://www.jasonkohles.com/ to support Module::Build installed modules
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-PERL ?= /usr/bin/perl
-PACKAGE = $(shell dh_listpackages)
-TMP = $(CURDIR)/debian/$(PACKAGE)
-
-build: build-stamp
-build-stamp:
- dh_testdir
- $(PERL) Build.PL installdirs=vendor
- $(PERL) Build
- $(PERL) Build test
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
- dh_clean build-stamp install-stamp
- [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
-
-install: install-stamp
-install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
- $(PERL) Build install destdir=$(TMP) create_packlist=0
- touch $@
-
-binary-arch:
-# We have nothing to do here for an architecture-independent package
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installdocs README
- dh_installexamples examples/*
- chmod a-x $(TMP)/usr/share/doc/$(PACKAGE)/examples/*
- dh_installchangelogs Changes
- dh_perl
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+%:
+ dh $@
Modified: trunk/libio-prompt-perl/examples/underscore.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/examples/underscore.pl?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/examples/underscore.pl (original)
+++ trunk/libio-prompt-perl/examples/underscore.pl Mon Jan 11 01:51:33 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: trunk/libio-prompt-perl/lib/IO/Prompt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-prompt-perl/lib/IO/Prompt.pm?rev=50676&op=diff
==============================================================================
--- trunk/libio-prompt-perl/lib/IO/Prompt.pm (original)
+++ trunk/libio-prompt-perl/lib/IO/Prompt.pm Mon Jan 11 01:51:33 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
More information about the Pkg-perl-cvs-commits
mailing list