From a96037a5fce3c6e4f45fd7c9805d89a17c7afb2f Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Thu, 24 Nov 2016 20:58:08 +0100 Subject: [PATCH] replacement for POSIX::isprint() (fixes RT #118893) --- Build.PL | 1 - Makefile.PL | 1 - lib/IO/Prompt.pm | 9 +++------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Build.PL b/Build.PL index 1077726..4b856d5 100644 --- a/Build.PL +++ b/Build.PL @@ -12,7 +12,6 @@ my $builder = Module::Build->new( 'version' => 0, 'IO::Handle' => 0, 'Term::ReadKey' => 0, - 'POSIX' => 0, 'Want' => 0, }, add_to_cleanup => [ 'IO-Prompt-*' ], diff --git a/Makefile.PL b/Makefile.PL index bbd9687..e77b1d5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -13,7 +13,6 @@ WriteMakefile( 'version' => 0, 'IO::Handle' => 0, 'Term::ReadKey' => 0, - 'POSIX' => 0, 'Want' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, diff --git a/lib/IO/Prompt.pm b/lib/IO/Prompt.pm index a4b9801..c2a96c2 100644 --- a/lib/IO/Prompt.pm +++ b/lib/IO/Prompt.pm @@ -13,7 +13,8 @@ our @EXPORT_OK = qw( hand_print get_input ); use IO::Handle; use Term::ReadKey; -use POSIX qw( isprint ); + +sub _isprint { $_[0] =~ qr/ ^ [[:print:]]+ $ /x } my $clearfirst; my %input; @@ -323,7 +324,7 @@ my $baseline = ord 'A'; sub _visualize { local ($_) = @_; - return isprint($_) ? $_ + return _isprint($_) ? $_ : $_ eq "\n" ? $_ : ord($_) == 0 ? '' : ord($_) < $baseline ? '^' . chr($baseline + ord($_) - 1) @@ -848,10 +849,6 @@ IO::Handle Term::ReadKey -=item * - -POSIX - =back -- 2.1.2