[libio-prompter-perl] 01/01: Imported Upstream version 0.004006
Salvatore Bonaccorso
carnil at debian.org
Thu Aug 29 20:24:15 UTC 2013
This is an automated email from the git hooks/post-receive script.
carnil pushed a commit to annotated tag upstream/0.004006
in repository libio-prompter-perl.
commit 8938e2e09f20c71e89ac7cdbb55dce8081e9110f
Author: Salvatore Bonaccorso <carnil at debian.org>
Date: Thu Aug 29 22:22:29 2013 +0200
Imported Upstream version 0.004006
---
Changes | 7 +++++++
META.yml | 2 +-
README | 2 +-
lib/IO/Prompter.pm | 22 +++++++++++-----------
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/Changes b/Changes
index 96f5e79..fddd9fc 100644
--- a/Changes
+++ b/Changes
@@ -107,3 +107,10 @@ Revision history for IO-Prompter
* Disabled interactive testing on Windows platforms
(thanks Brian and Lady Aleena)
+
+
+0.004006 Thu Aug 29 10:28:48 2013
+
+ * Better handling of input EOL under Windows (thanks Bas)
+
+ * Workaround for Term::ReadKey bug under Windows (thanks Bas)
diff --git a/META.yml b/META.yml
index ed6af44..b4c9796 100644
--- a/META.yml
+++ b/META.yml
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: IO-Prompter
-version: 0.004005
+version: 0.004006
abstract: Prompt for input, read it, clean it, return it.
author:
- Damian Conway <DCONWAY at CPAN.org>
diff --git a/README b/README
index 97067c4..dd3a5c1 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-IO::Prompter version 0.004005
+IO::Prompter version 0.004006
Prompt for, read, vet, chomp, and encapsulate input.
Like so:
diff --git a/lib/IO/Prompter.pm b/lib/IO/Prompter.pm
index b9e8240..2e3e8d2 100644
--- a/lib/IO/Prompter.pm
+++ b/lib/IO/Prompter.pm
@@ -8,7 +8,7 @@ use Contextual::Return;
use Scalar::Util qw< openhandle looks_like_number >;
use Symbol qw< qualify_to_ref >;
-our $VERSION = '0.004005';
+our $VERSION = '0.004006';
my $fake_input; # Flag that we're faking input from the source
@@ -211,7 +211,7 @@ sub prompt {
# Provide default value if available and necessary...
my $defaulted = 0;
- if (defined $input && $input =~ /\A\n?\Z/ && exists $opt_ref->{-def}) {
+ if (defined $input && $input =~ /\A\R?\Z/ && exists $opt_ref->{-def}) {
$input = $opt_ref->{-def};
$defaulted = 1;
}
@@ -941,7 +941,7 @@ sub _verify_input_constraints {
# Reset faked input, if any...
if (defined $fake_input && length($fake_input) > 0) {
- $fake_input =~ s{ \A (.*) \n? }{}xm;
+ $fake_input =~ s{ \A (.*) \R? }{}xm;
${$local_fake_input_ref} = $1;
}
@@ -969,7 +969,7 @@ sub _generate_buffered_reader_from {
# Set up local faked input, if any...
my $local_fake_input;
if (defined $fake_input && length($fake_input) > 0) {
- $fake_input =~ s{ \A (.*) \n? }{}xm;
+ $fake_input =~ s{ \A (.*) \R? }{}xm;
$local_fake_input = $1;
}
@@ -1163,8 +1163,8 @@ sub _generate_unbuffered_reader_from {
my $VERBATIM_KEY = $ctrl{QUOTENEXT} // $DEFAULT_VERBATIM_KEY;
- # Translate timeout for ReadKey...
- my $timeout = !defined $opt_ref->{-timeout} ? 0
+ # Translate timeout for ReadKey (with MAXINT workaround for Windows)...
+ my $timeout = !defined $opt_ref->{-timeout} ? (-1>>1) # MAXINT
: $opt_ref->{-timeout} == 0 ? -1
: $opt_ref->{-timeout}
;
@@ -1194,7 +1194,7 @@ sub _generate_unbuffered_reader_from {
# Set up local faked input, if any...
my $local_fake_input;
if (defined $fake_input && length($fake_input) > 0) {
- $fake_input =~ s{ \A (.*) \n? }{}xm;
+ $fake_input =~ s{ \A (.*) \R? }{}xm;
$local_fake_input = $1;
}
@@ -1362,7 +1362,7 @@ sub _generate_unbuffered_reader_from {
}
# Handle returns...
- elsif (!$prev_was_verbatim && $next eq "\n") {
+ elsif (!$prev_was_verbatim && $next =~ /\A\R\z/) {
# Complete faked line, if faked input incomplete...
if ($faking && length($local_fake_input)) {
for (split q{}, $local_fake_input) {
@@ -1382,7 +1382,7 @@ sub _generate_unbuffered_reader_from {
);
# Echo a default value if appropriate...
- if ($input =~ m{\A\n?\Z}xms && defined $opt_ref->{-def}) {
+ if ($input =~ m{\A\R?\Z}xms && defined $opt_ref->{-def}) {
my $def_val = $opt_ref->{-def};
# Try to find the key, for a menu...
@@ -1500,7 +1500,7 @@ sub _generate_unbuffered_reader_from {
# Otherwise supply a final newline if necessary...
if ( $opt_ref->{-single}
&& exists $opt_ref->{-return}
- && $input ne "\n" ) {
+ && $input !~ /\A\R\z/ ) {
$outputter_ref->(-echostyle => $opt_ref->{-return}(q{}));
}
@@ -1678,7 +1678,7 @@ IO::Prompter - Prompt for input, read it, clean it, return it.
=head1 VERSION
-This document describes IO::Prompter version 0.004005
+This document describes IO::Prompter version 0.004006
=head1 SYNOPSIS
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libio-prompter-perl.git
More information about the Pkg-perl-cvs-commits
mailing list