This queue is for tickets about the IO-Prompt CPAN distribution.

Report information
The Basics
Id:
127720
Status:
open
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
gilles [...] lamiral.info
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



MIME-Version: 1.0
X-Spam-Status: No, score=-2.328 tagged_above=-99.9 required=10 tests=[AWL=-1.429, BAYES_00=-1.9, FROM_INFO=1, SPF_FAIL=0.001] autolearn=no
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
Content-Language: en-GB
content-type: text/plain; charset="utf-8"
Message-ID: <a4ecbf16-6f27-3e09-548c-ee043438f084@lamiral.info>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -2.328
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id B0E1E2402E6 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Sun, 18 Nov 2018 10:58:33 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xHQN24NEEge1 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Sun, 18 Nov 2018 10:58:32 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id 5E7212400A0 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 10:58:32 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 5A00667016 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 07:58:29 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 6739767017 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 07:58:26 -0800 (PST)
Received: from ks.lamiral.info (ks.lamiral.info [5.135.158.182]) by xx1.develooper.com (Postfix) with ESMTP id 9C15D67016 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 07:58:25 -0800 (PST)
Received: from [192.168.103.101] (lamiral.info [78.205.231.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ks.lamiral.info (Postfix) with ESMTPSA id 262C811E1622 for <bug-IO-Prompt@rt.cpan.org.>; Sun, 18 Nov 2018 16:53:24 +0100 (CET)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
Subject: When @ARGV is localized, prompt does not prompt a prompt.
Return-Path: <gilles@lamiral.info>
X-RT-Mail-Extension: io-prompt
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1100_1199 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_CTA_URI_FOUND 0, NO_URI_FOUND 0, NO_URI_HTTPS 0, SPF_PASS 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_MSGID 0, __INFO_FROM 0, __INT_PROD_LOC 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MOZILLA_USER_AGENT 0, __NO_HTML_TAG_RAW 0, __RUS_OBFU_PHONE 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __USER_AGENT 0, __blackholes.mail-abuse.org_ERROR , __zen.spamhaus.org_ERROR '
Date: Sun, 18 Nov 2018 16:52:22 +0100
X-Spam-Level:
X-Greylist: delayed 360 seconds by postgrey-1.34 at xx1.develooper.com; Sun, 18 Nov 2018 07:58:25 PST
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.11.18.155116
To: bug-IO-Prompt@rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Gilles LAMIRAL <gilles@lamiral.info>
X-RT-Original-Encoding: utf-8
X-RT-Interface: Email
Content-Length: 1115
Hi Damian, Here is a little script showing an issue when @ARGV is localized: IO::Prompt::prompt() does not prompt a prompt. I searched in the source where it could be fixed. Not found, too complex for me! (I felt like an elephant in a Chinese store) #!/usr/bin/perl use strict; use warnings; use IO::Prompt; # The defect is when used with a pipe, like the following on the command line example, # prompt() does not print the prompt string 'Say something: ' # however the variable @ARGV is locally empty. # The output is then only: # # $ echo bla bla bla | ./bug_io_prompt_local_ARGV param1 param2 # ARGV are param1 param2 # You said: bla bla bla # I tried also # prompt( \*STDOUT, 'Say something: '); # The behavior is ok without the pipe: # ./bug_io_prompt_local_ARGV param1 param2 print "$IO::Prompt::VERSION\n" ; print "ARGV are @ARGV\n" ; my $input = get_stdin(); print "You said: $input\n" ; sub get_stdin { local(@ARGV) ; my $input = prompt('Say something: '); return $input ; } -- Au revoir, Gilles Lamiral. France, Baulon (35580) mob 06 19 22 03 54 tel 09 51 84 42 42
MIME-Version: 1.0
X-Spam-Status: No, score=-5.332 tagged_above=-99.9 required=10 tests=[AWL=-0.099, BAYES_00=-1.9, FREEMAIL_FROM=0.001, FROM_OUR_RT=-4, HTML_MESSAGE=0.001, SPF_SOFTFAIL=0.665] autolearn=ham
In-Reply-To: <rt-4.0.18-19282-1542556714-1842.127720-4-0@rt.cpan.org>
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-127720@rt.cpan.org> <a4ecbf16-6f27-3e09-548c-ee043438f084@lamiral.info> <rt-4.0.18-19282-1542556714-1842.127720-4-0@rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 2002:a19:cec8:: with SMTP id e191mr9618761lfg.13.1542593778049; Sun, 18 Nov 2018 18:16:18 -0800 (PST)
Message-ID: <CAATtAp6iTRWzPtCyWsfRWeuzWGzm=6cgdi1WWFfLBQ4aGTOdVA@mail.gmail.com>
Content-Type: multipart/alternative; boundary="0000000000002c66eb057afb1a95"
X-Spam-Score: -5.332
X-Google-SMTP-Source: AJdET5coNeVWXPMGM0V0sNXqrVRD6v2XOwS3wUvNu4bxmGw5E2ONRD2DKmG2sCnp7WCuQ+l4EQuEnj6lNe5rXrftscY=
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 904482401AA for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Sun, 18 Nov 2018 21:16:31 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G8bqo9xrMrS1 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Sun, 18 Nov 2018 21:16:30 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id D4B182400A0 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 21:16:29 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 3DB5D11D87C for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 18:16:28 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id C455A11F4D6 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 18:16:21 -0800 (PST)
Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 0E1CD11D87C for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 18:16:20 -0800 (PST)
Received: by mail-lf1-f41.google.com with SMTP id l10so16573885lfh.9 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 18:16:20 -0800 (PST)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
Subject: Re: [rt.cpan.org #127720] When @ARGV is localized, prompt does not prompt a prompt.
Return-Path: <thoughtstream@gmail.com>
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-RT-Mail-Extension: io-prompt
X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=C515fv4UNtHxcHfPMr8iU0jj2KyE7oDYyRIQJaE4oXs=; b=ThefSCgvKvawqax6PvxD77jxPHurxrHEuK3fPDsR7dxb4HP6vqWTtfbW5iWDzP/Z6s GMsCrCgXqDE16szKLRe/g4OE3Q+TVy5+o3MM2HHQ0dEeKayw19NKBUQzh+lNrhAEaopY zyWcAiTbFQek3E781OZaklV1RxBBoBbKQWaG3eD+bl4DA/cf+cazVszhfw1yd2hPvTpo Q9+gyBehAzVFwEV6rTRwUKYiIPI0i0j3jLrcrR+fv67gSA82rxMYbQoaW7D+lCR/ALqR PMoYOmsT2Pw89eQcyVQw/gtIdT1P65/2WyK27D8mrHkn/dA2SUxCHsfi6hAxrFOZa6Oe 2rEw==
Date: Mon, 19 Nov 2018 02:15:50 +0000
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_NO_HTTP 0.1, BODYTEXTH_SIZE_10000_LESS 0, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, NO_URI_HTTPS 0, REFERENCES 0, SPF_PASS 0, WEBMAIL_SOURCE 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_ALT 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __FUR_RDNS_GMAIL 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HELO_GMAIL 0, __HEX28_LC_BOUNDARY 0, __HIGHBITS 0, __HTML_TAG_DIV 0, __IN_REP_TO 0, __MIME_HTML 0, __MIME_TEXT_H 0, __MIME_TEXT_H1 0, __MIME_TEXT_H2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0, __MIME_VERSION 0, __RDNS_WEBMAIL 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_NEGATE 0, __SUBJ_REPLY 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_WWW 0, __URI_NS , __X_GOOGLE_DKIM_SIGNATURE 0, __YOUTUBE_RCVD 0, __zen.spamhaus.org_ERROR '
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.11.19.20616
To: bug-IO-Prompt@rt.cpan.org
X-GM-Message-State: AGRZ1gJKX1nRRK+3l1luNm44MrdDGWCHgAtZXQayyqimhTwubiS01vpR v2QnGeRROIPPbb9bwYwWkD596ZuWBG7CqSdLPNKLAo9Kr0MVRg==
From: Damian Conway <damian@conway.org>
RT-Message-ID: <rt-4.0.18-13925-1542593792-694.127720-0-0@rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 747
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 1341
Hi Gilles,

The problem is not the localization of @ARGV (which has no effect on the
*ARGV filehandle, which is what prompt() reads from).

The problem is that, when input is piped, *ARGV is not connected to a tty,
so IO::Prompt doesn't bother prompt for input that could not be typed in anyway.

The solution is to use the -tty flag to override the (non-)reading of *ARGV.
Like so:

    sub get_stdin
    {
            my $input = prompt(-tty, 'Say something: ');
            return $input ;
    }

Hope this helps,

Damian

PS: IO::Prompt is no longer under active maintenance.
    You may want to take a look at the IO::Prompter module instead.
    Though, of course, that would not have behaved any differently
    in this particular example.


MIME-Version: 1.0
X-Spam-Status: No, score=-4.149 tagged_above=-99.9 required=10 tests=[AWL=0.750, BAYES_00=-1.9, FROM_INFO=1, FROM_OUR_RT=-4, SPF_FAIL=0.001] autolearn=ham
In-Reply-To: <rt-4.0.18-13925-1542593792-630.127720-6-0@rt.cpan.org>
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-127720@rt.cpan.org> <a4ecbf16-6f27-3e09-548c-ee043438f084@lamiral.info> <rt-4.0.18-19282-1542556714-1842.127720-4-0@rt.cpan.org> <CAATtAp6iTRWzPtCyWsfRWeuzWGzm=6cgdi1WWFfLBQ4aGTOdVA@mail.gmail.com> <rt-4.0.18-13925-1542593792-630.127720-6-0@rt.cpan.org>
Content-Language: en-GB
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <739dac8a-986f-7ccc-5252-89446a0aaaca@lamiral.info>
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -4.149
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id A273E2402E6 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Mon, 19 Nov 2018 02:33:39 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1YYd9aznq-Jl for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Mon, 19 Nov 2018 02:33:38 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id 17DBD2400A0 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 02:33:37 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 73F6A1225E4 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 23:33:36 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 7265F1225E8 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 23:33:33 -0800 (PST)
Received: from ks.lamiral.info (ks.lamiral.info [5.135.158.182]) by xx1.develooper.com (Postfix) with ESMTP id 798DB1225E4 for <bug-IO-Prompt@rt.cpan.org>; Sun, 18 Nov 2018 23:33:31 -0800 (PST)
Received: from [192.168.103.101] (lamiral.info [78.205.231.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ks.lamiral.info (Postfix) with ESMTPSA id DFB2B11E161A for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 08:34:32 +0100 (CET)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
Subject: Re: [rt.cpan.org #127720] When @ARGV is localized, prompt does not prompt a prompt.
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
Return-Path: <gilles@lamiral.info>
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-RT-Mail-Extension: io-prompt
Date: Mon, 19 Nov 2018 08:33:28 +0100
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_500_599 0, BODY_SIZE_7000_LESS 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, NO_URI_HTTPS 0, REFERENCES 0, SPF_PASS 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __HAS_FROM 0, __HAS_MSGID 0, __INFO_FROM 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MOZILLA_USER_AGENT 0, __NO_HTML_TAG_RAW 0, __REFERENCES 0, __RUS_OBFU_PHONE 0, __SANE_MSGID 0, __SUBJ_ALPHA_NEGATE 0, __SUBJ_REPLY 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0, __blackholes.mail-abuse.org_ERROR , __zen.spamhaus.org_ERROR '
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.11.19.72717
To: bug-IO-Prompt@rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Gilles LAMIRAL <gilles@lamiral.info>
RT-Message-ID: <rt-4.0.18-6240-1542612820-1114.127720-0-0@rt.cpan.org>
Content-Length: 567
Hi Damian, You misunderstood the issue. I don't want the -tty behaviour. In that case of a pipe, I don't want prompt to read from the terminal tty, I want it to read from the pipe, classical Unix STDIN, and it does so. But in that case, a pipe, it does not output the prompt on STDOUT. So if the whole process is logged to file or read on the terminal you see prompt() getting the right value without "asking" any questions. I hope IO::Prompter does not behave like so. -- Au revoir, Gilles Lamiral. France, Baulon (35580) mob 06 19 22 03 54 tel 09 51 84 42 42
MIME-Version: 1.0
X-Spam-Status: No, score=-5.332 tagged_above=-99.9 required=10 tests=[AWL=-0.099, BAYES_00=-1.9, FREEMAIL_FROM=0.001, FROM_OUR_RT=-4, HTML_MESSAGE=0.001, SPF_SOFTFAIL=0.665] autolearn=ham
In-Reply-To: <rt-4.0.18-6240-1542612820-847.127720-5-0@rt.cpan.org>
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-127720@rt.cpan.org> <a4ecbf16-6f27-3e09-548c-ee043438f084@lamiral.info> <rt-4.0.18-19282-1542556714-1842.127720-4-0@rt.cpan.org> <CAATtAp6iTRWzPtCyWsfRWeuzWGzm=6cgdi1WWFfLBQ4aGTOdVA@mail.gmail.com> <rt-4.0.18-13925-1542593792-630.127720-6-0@rt.cpan.org> <739dac8a-986f-7ccc-5252-89446a0aaaca@lamiral.info> <rt-4.0.18-6240-1542612820-847.127720-5-0@rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 2002:a2e:7f04:: with SMTP id a4-v6mr12122164ljd.156.1542615195839; Mon, 19 Nov 2018 00:13:15 -0800 (PST)
Message-ID: <CAATtAp5gf=T8B0212eg3dynDGmh6njWAUhJCHvymB6iM4PQPOQ@mail.gmail.com>
Content-Type: multipart/alternative; boundary="000000000000c5f384057b00164f"
X-Spam-Score: -5.332
X-Google-SMTP-Source: AJdET5eJTiHvAoorj30u345UeGK/U/9uhOgvXWxsDCKpONs5s9kwQCOy4XF09iyEOOG7phDt8cMAiXAz6KTL+ANvLLA=
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 0FE092401AA for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Mon, 19 Nov 2018 03:13:25 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CslpVC8taiRI for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Mon, 19 Nov 2018 03:13:23 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id 273AE2400A0 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 03:13:23 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 0B08111F94E for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 00:13:22 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 76DCA11F943 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 00:13:19 -0800 (PST)
Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id BCEF111F94E for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 00:13:17 -0800 (PST)
Received: by mail-lj1-f182.google.com with SMTP id l15-v6so17115177lja.9 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 00:13:17 -0800 (PST)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
Subject: Re: [rt.cpan.org #127720] When @ARGV is localized, prompt does not prompt a prompt.
Return-Path: <thoughtstream@gmail.com>
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-RT-Mail-Extension: io-prompt
X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=OFo09NcICldebvytX0i0x/o07o+qRytB8NJGyY5L0o0=; b=Hoa/fDvRAqUsesOkJ8mW+dmm3dBakZ7p2y5iq1u4zFFL+riyKoXWqinNMN1viNL72M +2OCH20tqNKD8lQGkq4/PpLmmCBhtZxbibxjXpWLTQ9Z6PxRZYfGZcHxKTby+XcenMqn ghh5xq9oGC/GdG8Dwv0eeNDMUXzmELitEEgAXbGpv5pdwuYiA4lCJPq5+y8nc3jl9oDf hmMps0Hq6tRRTf0e5WU+7NcBekNilLiFXR0sg39Ug6eX5T8sjwzqNAMKX+vEgppL5nIT ah936AQhVaE7H0964Eyh2LDSPQjIPhVwNt5LWitkBogf7VMk91MzD+KOQlLQcAwHn6nb QDvg==
Date: Mon, 19 Nov 2018 08:12:51 +0000
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_NO_HTTP 0.1, BODYTEXTH_SIZE_10000_LESS 0, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, NO_URI_HTTPS 0, REFERENCES 0, SPF_PASS 0, WEBMAIL_SOURCE 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_ALT 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __FUR_RDNS_GMAIL 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HELO_GMAIL 0, __HEX28_LC_BOUNDARY 0, __HIGHBITS 0, __HTML_TAG_DIV 0, __IN_REP_TO 0, __MIME_HTML 0, __MIME_TEXT_H 0, __MIME_TEXT_H1 0, __MIME_TEXT_H2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0, __MIME_VERSION 0, __RDNS_WEBMAIL 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_NEGATE 0, __SUBJ_REPLY 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_WWW 0, __URI_NS , __X_GOOGLE_DKIM_SIGNATURE 0, __YOUTUBE_RCVD 0, __zen.spamhaus.org_ERROR '
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.11.19.80616
To: bug-IO-Prompt@rt.cpan.org
X-GM-Message-State: AGRZ1gIzwNokzGqzOK4UiCHHcx1HUd8Zlc1Z8X2Fs4Nmt1HPRIlf0YH9 kxGTxCp6HzA75EgYoWFTtZIef61l+XIeUfzQoKVx7F/iEZ+IQA==
From: Damian Conway <damian@conway.org>
RT-Message-ID: <rt-4.0.18-26038-1542615205-1889.127720-0-0@rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 933
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 1185


> But in that case, a pipe, it does not output the prompt on STDOUT.
> So if the whole process is logged to file or read on the terminal
> you see prompt() getting the right value without "asking" any questions.

You are correct: here is no way to do that using IO::Prompt.

> I hope IO::Prompter does not behave like so.

I'm afraid it does.

The whole point is that both modules are designed to allow you to
put a prompted app inside a pipeline and NOT have the unnecessary
prompts appear in the output. Neither module provides a mechanism
to do what you want.

Given what you want, why not just write your own:

    sub prompt {
        my ($prompt_str) = @_;
        print $prompt_str;
        my $input = readline(*ARGV);
        if (!-t *ARGV) {
            print $input;
        }
        chomp $input;
        return $input;
    }

This would do precisely what you need,
(assuming I now understand you correctly. ;-)

Damian

MIME-Version: 1.0
X-Spam-Status: No, score=-4.232 tagged_above=-99.9 required=10 tests=[AWL=0.667, BAYES_00=-1.9, FROM_INFO=1, FROM_OUR_RT=-4, SPF_FAIL=0.001] autolearn=ham
In-Reply-To: <rt-4.0.18-26038-1542615206-1240.127720-6-0@rt.cpan.org>
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-127720@rt.cpan.org> <a4ecbf16-6f27-3e09-548c-ee043438f084@lamiral.info> <rt-4.0.18-19282-1542556714-1842.127720-4-0@rt.cpan.org> <CAATtAp6iTRWzPtCyWsfRWeuzWGzm=6cgdi1WWFfLBQ4aGTOdVA@mail.gmail.com> <rt-4.0.18-13925-1542593792-630.127720-6-0@rt.cpan.org> <739dac8a-986f-7ccc-5252-89446a0aaaca@lamiral.info> <rt-4.0.18-6240-1542612820-847.127720-5-0@rt.cpan.org> <CAATtAp5gf=T8B0212eg3dynDGmh6njWAUhJCHvymB6iM4PQPOQ@mail.gmail.com> <rt-4.0.18-26038-1542615206-1240.127720-6-0@rt.cpan.org>
Content-Language: en-GB
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <ee4d7764-0236-a486-1954-27bc4349a625@lamiral.info>
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -4.232
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id E77B2240270 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Mon, 19 Nov 2018 13:24:43 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jlUiV6D0LajC for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Mon, 19 Nov 2018 13:24:42 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id 5AD8D24011F for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 13:24:42 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id D0E3B121063 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 10:24:40 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 7B395121074 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 10:24:38 -0800 (PST)
Received: from ks.lamiral.info (ks.lamiral.info [5.135.158.182]) by xx1.develooper.com (Postfix) with ESMTP id 969EC121063 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 10:24:36 -0800 (PST)
Received: from [192.168.103.101] (lamiral.info [78.205.231.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ks.lamiral.info (Postfix) with ESMTPSA id 4C9E211E16D2 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 19:25:38 +0100 (CET)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
Subject: Re: [rt.cpan.org #127720] When @ARGV is localized, prompt does not prompt a prompt.
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
Return-Path: <gilles@lamiral.info>
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-RT-Mail-Extension: io-prompt
Date: Mon, 19 Nov 2018 19:24:32 +0100
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_600_699 0, BODY_SIZE_7000_LESS 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, NO_URI_HTTPS 0, REFERENCES 0, SPF_PASS 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_MSGID 0, __INFO_FROM 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MOZILLA_USER_AGENT 0, __REFERENCES 0, __RUS_OBFU_PHONE 0, __SANE_MSGID 0, __SUBJ_ALPHA_NEGATE 0, __SUBJ_REPLY 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0, __blackholes.mail-abuse.org_ERROR , __zen.spamhaus.org_ERROR '
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.11.19.181816
To: bug-IO-Prompt@rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Gilles LAMIRAL <gilles@lamiral.info>
RT-Message-ID: <rt-4.0.18-23887-1542651884-1657.127720-0-0@rt.cpan.org>
Content-Length: 613
Hi Damian, My goal is just to replace a perlcritic level 4 my $input = <STDIN> ; Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>" 1 violations of InputOutput::ProhibitExplicitStdin That way, using <STDIN>, I do have what I want, like a shell reading STDIN, no matter the arguments: echo input | { echo -n "prompt: " ; read stdin ; echo "got $stdin" ; } It could be an option in IO::Prompter, if someone else needs it one day. For now I'm ok with ## no critic InputOutput::ProhibitExplicitStdin -- Au revoir, Gilles Lamiral. France, Baulon (35580) mob 06 19 22 03 54 tel 09 51 84 42 42
MIME-Version: 1.0
X-Spam-Status: No, score=-5.331 tagged_above=-99.9 required=10 tests=[AWL=-0.098, BAYES_00=-1.9, FREEMAIL_FROM=0.001, FROM_OUR_RT=-4, HTML_MESSAGE=0.001, SPF_SOFTFAIL=0.665] autolearn=ham
In-Reply-To: <rt-4.0.18-23887-1542651884-1621.127720-5-0@rt.cpan.org>
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-127720@rt.cpan.org> <a4ecbf16-6f27-3e09-548c-ee043438f084@lamiral.info> <rt-4.0.18-19282-1542556714-1842.127720-4-0@rt.cpan.org> <CAATtAp6iTRWzPtCyWsfRWeuzWGzm=6cgdi1WWFfLBQ4aGTOdVA@mail.gmail.com> <rt-4.0.18-13925-1542593792-630.127720-6-0@rt.cpan.org> <739dac8a-986f-7ccc-5252-89446a0aaaca@lamiral.info> <rt-4.0.18-6240-1542612820-847.127720-5-0@rt.cpan.org> <CAATtAp5gf=T8B0212eg3dynDGmh6njWAUhJCHvymB6iM4PQPOQ@mail.gmail.com> <rt-4.0.18-26038-1542615206-1240.127720-6-0@rt.cpan.org> <ee4d7764-0236-a486-1954-27bc4349a625@lamiral.info> <rt-4.0.18-23887-1542651884-1621.127720-5-0@rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 2002:a2e:4218:: with SMTP id p24-v6mr74582lja.58.1542679746804; Mon, 19 Nov 2018 18:09:06 -0800 (PST)
Message-ID: <CAATtAp7XUKdFmj1SWE8SUBkxurwCe7H9G3+Z2oMb6LTo38YB8w@mail.gmail.com>
Content-Type: multipart/alternative; boundary="0000000000004f8006057b0f1e7c"
X-Spam-Score: -5.331
X-Google-SMTP-Source: AFSGD/X4/7LtsemIBJZZo5Ps0aVA8p3v5D2lsEI9z9YoVPPON1tweFpL2ImaPEz3wFV+J5ni9JSyDResxCfaE9OYREo=
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 36365240246 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Mon, 19 Nov 2018 21:09:16 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KxlRIE5JEqBh for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Mon, 19 Nov 2018 21:09:14 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id 27C402400C0 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 21:09:14 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 25B0667016 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 18:09:13 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 869F767017 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 18:09:10 -0800 (PST)
Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id C54C167016 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 18:09:08 -0800 (PST)
Received: by mail-lj1-f180.google.com with SMTP id z80-v6so249905ljb.8 for <bug-IO-Prompt@rt.cpan.org>; Mon, 19 Nov 2018 18:09:08 -0800 (PST)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
Subject: Re: [rt.cpan.org #127720] When @ARGV is localized, prompt does not prompt a prompt.
Return-Path: <thoughtstream@gmail.com>
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-RT-Mail-Extension: io-prompt
X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=mMsHLEnKyQjx/0GTNmN9bbvATE0S6qobWvoYjCecvfs=; b=AEiFr6lHG5yrzCnof7b2EtwB0iFT/x+M8tHXwXJDSquR0X11/L/BZ7x6RFemf7/Bu7 n53WVOpEEA0KBgERaAEu+6rWCoYjCRzw4NRk4EGG/3A44XrLr38Fa0adIOrx3hg2Yqyc KqtM1zERVSS7AXak29+v8WLLqQvx55RAHNK9M/ib+eRde5P+q1n0QuEgV8jw5GKNfclk wd7rBYnLH9wN7nXVaLnPpwOsRp1iLntNAWeRfHOAbVh5v1IeUefA/R5opeeMPVSkEB1F wV3+VumdjMQls6XR9BvyYGx5i+fUYsA5JIx5HFi7QkGeqNUphgG3gAcz9c2NhA6Bc6La XKMg==
Date: Tue, 20 Nov 2018 02:08:47 +0000
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_NO_HTTP 0.1, BODYTEXTH_SIZE_10000_LESS 0, BODYTEXTP_SIZE_3000_LESS 0, BODYTEXTP_SIZE_400_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_500_599 0, BODY_SIZE_7000_LESS 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, NO_URI_HTTPS 0, REFERENCES 0, SMALL_BODY 0, SPF_PASS 0, WEBMAIL_SOURCE 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_ALT 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FUR_RDNS_GMAIL 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HELO_GMAIL 0, __HEX28_LC_BOUNDARY 0, __HTML_TAG_DIV 0, __IN_REP_TO 0, __MIME_HTML 0, __MIME_TEXT_H 0, __MIME_TEXT_H1 0, __MIME_TEXT_H2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0, __MIME_VERSION 0, __RDNS_WEBMAIL 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_NEGATE 0, __SUBJ_REPLY 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_WWW 0, __URI_NS , __X_GOOGLE_DKIM_SIGNATURE 0, __YOUTUBE_RCVD 0, __zen.spamhaus.org_ERROR '
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.11.20.20017
To: bug-IO-Prompt@rt.cpan.org
X-GM-Message-State: AA+aEWYPVXKzlVEyl2lO0VrjZqtnuEPr98KIUXzjolrkI0/vJt7aLoRu iRUM1Njl3GmMdU9c23pBL7uBvStJKmvDOX2PhGVMJJzM
From: Damian Conway <damian@conway.org>
RT-Message-ID: <rt-4.0.18-29060-1542679756-1083.127720-0-0@rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 138
content-type: text/html; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 249
> It could be an option in IO::Prompter, if someone else needs it one day.

I'll note it as a possible extension. Thanks, Gilles.

Damian



This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.