From e3282dbc1883738a66aed46de413cbec94043ea5 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 17 Oct 2019 16:23:29 +0200 Subject: [PATCH] TT#69150 Switch to use IO::Prompt::Tiny instead of ad-hoc code Change-Id: Ifdbff773894bf6f8d4e23b9d647b34487adcd954 (cherry picked from commit 565f5398254d0e9bb98e84ac39e0d738a6b8c74f) --- debian/control | 1 + lib/NGCP/BulkProcessor/Utils.pm | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/control b/debian/control index 198dc3f..a549898 100644 --- a/debian/control +++ b/debian/control @@ -52,6 +52,7 @@ Depends: libgearman-client-perl, libhtml-parser-perl, libintl-perl, + libio-prompt-tiny-perl, libio-socket-ssl-perl, liblog-log4perl-perl, libmail-imapclient-perl, diff --git a/lib/NGCP/BulkProcessor/Utils.pm b/lib/NGCP/BulkProcessor/Utils.pm index 09c36dc..ff24de9 100644 --- a/lib/NGCP/BulkProcessor/Utils.pm +++ b/lib/NGCP/BulkProcessor/Utils.pm @@ -29,6 +29,8 @@ Date_Init('DateFormat=US'); use Date::Calc qw(Normalize_DHMS Add_Delta_DHMS); +use IO::Prompt::Tiny; + use Text::Wrap qw(); #use FindBin qw($Bin); use Digest::MD5 qw(); #qw(md5 md5_hex md5_base64); @@ -1130,12 +1132,9 @@ sub get_cpucount { #printf "CPU load: %s\n" , $cpu->load || 0; } +# Compat wrapper. sub prompt { - my ($query) = @_; # take a prompt string as argument - local $| = 1; # activate autoflush to immediately show the prompt - print $query; - chomp(my $answer = ); - return $answer; + return IO::Prompt::Tiny::prompt(@_); } sub check_ipnet {