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

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

People
Owner:
Nobody in particular
Requestors:
bitshag [...] gmail.com
Cc:
AdminCc:

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



MIME-Version: 1.0
X-Spam-Status: No, score=-2.698 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
X-Spam-Flag: NO
Content-Type: multipart/alternative; boundary="089e011603f4fb479a04fa78f439"
Message-ID: <CAOVSj4xxfBqBFgfrSn8yoxqpyULzWZLYkuK56HUhr0MM75hFGg@mail.gmail.com>
X-Received: by 10.60.94.75 with SMTP id da11mr1148711oeb.43.1401297319968; Wed, 28 May 2014 10:15:19 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -2.698
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id B6A3D24090A for <cpan-bug+io-prompt@hipster.bestpractical.com>; Wed, 28 May 2014 13:15:33 -0400 (EDT)
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 clP7kbyFo-6a for <cpan-bug+io-prompt@hipster.bestpractical.com>; Wed, 28 May 2014 13:15:29 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 69598240883 for <bug-io-prompt@rt.cpan.org>; Wed, 28 May 2014 13:15:29 -0400 (EDT)
Received: (qmail 7949 invoked by alias); 28 May 2014 17:15:27 -0000
Received: from mail-ob0-f182.google.com (HELO mail-ob0-f182.google.com) (209.85.214.182) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Wed, 28 May 2014 10:15:25 -0700
Received: by mail-ob0-f182.google.com with SMTP id wn1so11130348obc.41 for <bug-io-prompt@rt.cpan.org>; Wed, 28 May 2014 10:15:21 -0700 (PDT)
Received: by 10.182.8.34 with HTTP; Wed, 28 May 2014 10:14:59 -0700 (PDT)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i=@gmail.com
Delivered-To: cpan-bug+io-prompt@hipster.bestpractical.com
Subject: possible bug
Return-Path: <bitshag@gmail.com>
X-RT-Mail-Extension: io-prompt
X-Original-To: cpan-bug+io-prompt@hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=jZrO9tfSQw3fxRpZWohCsYIt0jb4r/QT/g5AbqQ0uJg=; b=rVJwCupX1msfl6jJbfyrqNBJvQpJ1+uTpjywNrE+x2MXJag317yJgEBldm/Fs5NMTE cq4U/CmBScaFnXC2gocN5Q0t+SVrv4bwFcf15zYIlY1WcdI2Zjvr4hZxz6cgQmT6NcJl 4evOS1aV3PCokc2+ScCClYfYLNmyTjIXrUjyTaEDEvO/8TsvKC+ddU0kiMvVr0AxCwfZ TOUoFHE60InQcciesuvUG2czAzN6LHbrh3AL5AUZdAiyieEfMFXKb5AQjFt0oO0B9YM/ jK4ML+3x0J4vLJibm53Hbs+rRO+AX04APiLqmr99pnZBXXNDzf7r/878ZHhUECSbOmhG Np8Q==
Date: Wed, 28 May 2014 10:14:59 -0700
X-Spam-Level:
To: bug-io-prompt@rt.cpan.org
From: Erik Lyons <bitshag@gmail.com>
X-RT-Interface: Email
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 625
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 1076
If my script is called with an argument, @ARGV is in turn used by the IO::Prompt module when called, and it barfs. I worked around this with a pop(@ARGV) before issuing prompt(), which works great because i'm only using one arg. Never had to do that before. Yet i'm really surprised no-one else has encountered it.

Not sure if this is a bug or just an exposure of my limited Perl knowledge. Maybe there's a best-practice method of "localizing" @ARGV which i've neglected all these years?

CentOS 6.5 up to date with built-in Perl.

e.l.

"It's like a koala bear crapped a rainbow in my brain."
- Captain Hazel "Hank" Murphy


MIME-Version: 1.0
X-Spam-Status: No, score=-3.334 tagged_above=-99.9 required=10 tests=[AWL=0.565, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, FROM_OUR_RT=-2, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham
In-Reply-To: <rt-4.0.18-28461-1401297335-1740.96037-4-0@rt.cpan.org>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-96037@rt.cpan.org> <CAOVSj4xxfBqBFgfrSn8yoxqpyULzWZLYkuK56HUhr0MM75hFGg@mail.gmail.com> <rt-4.0.18-28461-1401297335-1740.96037-4-0@rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.69.19.140 with SMTP id gu12mr11442108pbd.111.1401392107113; Thu, 29 May 2014 12:35:07 -0700 (PDT)
Message-ID: <CAATtAp45fRj34cXXzRKXaWoMDg6Fyx3uzZsaxoyqq8Ts-VG7Bw@mail.gmail.com>
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -3.334
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i=@gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 7249461E00E for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Thu, 29 May 2014 15:35:14 -0400 (EDT)
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 38Bh43pzWsXD for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Thu, 29 May 2014 15:35:13 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 6107E61E00B for <bug-IO-Prompt@rt.cpan.org>; Thu, 29 May 2014 15:35:13 -0400 (EDT)
Received: (qmail 29245 invoked by alias); 29 May 2014 19:35:13 -0000
Received: from mail-pd0-f182.google.com (HELO mail-pd0-f182.google.com) (209.85.192.182) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 29 May 2014 12:35:11 -0700
Received: by mail-pd0-f182.google.com with SMTP id r10so82891pdi.41 for <bug-IO-Prompt@rt.cpan.org>; Thu, 29 May 2014 12:35:07 -0700 (PDT)
Received: by 10.70.77.6 with HTTP; Thu, 29 May 2014 12:34:26 -0700 (PDT)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
Subject: Re: [rt.cpan.org #96037] possible bug
Return-Path: <thoughtstream@gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=9zApod5ZC9OhCnr6HIndHAd7E5pVRtEvlcJfnnXR4vA=; b=AWI+CKCIAwlbtAl15hLu+A7pedynrIHqfpPIc3RHjbEJk6ok3FlcQgJ4cWQ/Mm8Q7n taklz9DyC9kyY7v/IJj9VlfGlQbZCBQWHL+rRl8dDwA2NZz3lGEJSfVdqvj7kV+qzfeW ELS/pEKbS2ZAMXoplBdEoeYnIlfY4ufyvzETn46LakClmYro/aIEEUh07oca5zmAYf5d SJacCcU8q57FOX2awb9l7ybvlERSBYmzAxHwnBY+drwhXcMGQbYloK3jhejyTIvm4s/D TgG/9kY+YoNA+NOJvZQDPYl/MJxZbgOK6vRsx1cOnIGt/Rfv2kpSuSr7EUJcOGcyAaX+ my9Q==
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-RT-Mail-Extension: io-prompt
X-Google-Sender-Auth: Hn2pgNxj-mh1_IoVtRKlx-24Wiw
Sender: thoughtstream@gmail.com
Date: Fri, 30 May 2014 05:34:26 +1000
X-Spam-Level:
To: bug-IO-Prompt@rt.cpan.org
From: Damian Conway <damian@conway.org>
RT-Message-ID: <rt-4.0.18-31576-1401392115-1820.96037-0-0@rt.cpan.org>
Content-Length: 739
Hi Erik, This is not a bug. It's a standard behaviour of Perl itself. prompt() uses the *ARGV filehandle (the same one that readline() and <> use). Perl's special behaviour is that, if @ARGV contains a value when a readline() is performed, that value is used as the name of a file, which is opened into *ARGV. This behaviour is described in detail in the perlop manpage, under "I/O Operators". Because prompt() acts like readline(), if your @ARGV contains any value when prompt() is called, it's used as the name of a file to read from. The workaround is either to clear @ARGV before reading, or else to localize @ARGV while reading, or to use the -tty option to prompt(): my $input = prompt -tty, '> '; Hope this helps, 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.