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

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

People
Owner:
Nobody in particular
Requestors:
ipaetzold [...] gmx.de
Cc:
AdminCc:

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



From ipaetzold@gmx.de Tue Apr 13 15: 15:36 2010
MIME-Version: 1.0
X-Spam-Status: No, score=-9.905 tagged_above=-99.9 required=10 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-8, SPF_FAIL=0.693] autolearn=ham
X-Mailer: WWW-Mail 6100 (Global Message Exchange)
X-Spam-Flag: NO
X-Provags-ID: V01U2FsdGVkX197A0pqQjd7S46JQPX9MtMNDHX6gGwtzE9VdnRUrV Ty0KwCnfWhnBCLCCivMm4krQaqqKBmitjs7Q==
X-Authenticated: #1541575
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
Message-ID: <20100413191503.280800@gmx.net>
Content-Type: multipart/alternative; boundary="========GMXBoundary280801271186103603055"
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -9.905
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 02DCF2405D4 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Tue, 13 Apr 2010 15:15:36 -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 oiqEaXWMkraY for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Tue, 13 Apr 2010 15:15:32 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 37AD1240563 for <bug-IO-Prompt@rt.cpan.org>; Tue, 13 Apr 2010 15:15:32 -0400 (EDT)
Received: (qmail 4400 invoked by uid 103); 13 Apr 2010 19:15:38 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 13 Apr 2010 19:15:38 -0000
Received: from mail.gmx.net (HELO mail.gmx.net) (213.165.64.20) by 16.mx.develooper.com (qpsmtpd/0.80) with SMTP; Tue, 13 Apr 2010 12:15:32 -0700
Received: (qmail 4095 invoked by uid 0); 13 Apr 2010 19:15:06 -0000
Received: from 79.212.231.89 by www092.gmx.net with HTTP; Tue, 13 Apr 2010 21:15:03 +0200 (CEST)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-GMX-Uid: 1q6vI/k4TlI8Wq/gYGhrkrdOU2poZdkP
Subject: Bug: Use of uninitialized value $newlines
Return-Path: <ipaetzold@gmx.de>
X-Priority: 3
X-Flags: 0001
X-RT-Mail-Extension: io-prompt
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-Spam-Check-BY: 16.mx.develooper.com
Date: Tue, 13 Apr 2010 21:15:03 +0200
X-Spam-Level:
X-Fuhafi: 0.53000000000000003,0.53000000000000003
To: bug-IO-Prompt@rt.cpan.org
From: ipaetzold@gmx.de
Content-Length: 0
content-type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-RT-Original-Encoding: iso-8859-1
Content-Length: 717
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 1963
Hi there,
I tried an example from the O'Reilly book "Perl best practices".

Here's the code:
while( 1 )
{
    my $Choice = prompt 'Press key [a-e]: ', -onechar;
    print "Pressed: $Choice\n";
}


The output is with an unexpected error message:
Press key [a-e]: aUse of uninitialized value $newlines in print at /usr/local/share/perl/5.10.0/IO/Prompt.pm line 465.
Pressed: a


Perl version:
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi

OS version:
Linux delta 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 05:23:09 UTC 2010 i686 GNU/Linux


Thanks for notice. Ingmar



--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
From ipaetzold@gmx.de Wed Apr 14 14: 16:21 2010
MIME-Version: 1.0
X-Y-GMX-Trusted: 0
X-Spam-Status: No, score=-9.905 tagged_above=-99.9 required=10 tests=[AWL=0.001, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8, SPF_FAIL=0.693] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-26545-1271186145-562.56568-3-0@rt.cpan.org>
X-Spam-Flag: NO
X-Authenticated: #1541575
X-Provags-ID: V01U2FsdGVkX18JXhcGSNkJRnas9zwHCFCZQP8D9qXqtoL5QXk1/w GHbkixbrsko/sv
References: <RT-Ticket-56568@rt.cpan.org> <20100413191503.280800@gmx.net> <rt-3.8.HEAD-26545-1271186145-562.56568-3-0@rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <4BC6065F.7090807@gmx.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-RT-Original-Encoding: utf-8
X-Spam-Score: -9.905
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id C6F4F2401F8 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Wed, 14 Apr 2010 14:16:19 -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 uAVQ0szTDR-0 for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Wed, 14 Apr 2010 14:16:13 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 0DF8824063D for <bug-IO-Prompt@rt.cpan.org>; Wed, 14 Apr 2010 14:16:08 -0400 (EDT)
Received: (qmail 16228 invoked by uid 103); 14 Apr 2010 18:16:16 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 14 Apr 2010 18:16:16 -0000
Received: from mail.gmx.net (HELO mail.gmx.net) (213.165.64.20) by 16.mx.develooper.com (qpsmtpd/0.80) with SMTP; Wed, 14 Apr 2010 11:16:10 -0700
Received: (qmail invoked by alias); 14 Apr 2010 18:16:05 -0000
Received: from p4FD4E76D.dip.t-dialin.net (EHLO [192.168.2.100]) [79.212.231.109] by mail.gmx.net (mp026) with SMTP; 14 Apr 2010 20:16:05 +0200
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
User-Agent: Thunderbird 2.0.0.24 (X11/20100411)
Subject: [rt.cpan.org #56568] Fix proposal
Return-Path: <ipaetzold@gmx.de>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-RT-Mail-Extension: io-prompt
Date: Wed, 14 Apr 2010 20:15:59 +0200
X-Spam-Level:
X-Fuhafi: 0.48999999999999999
To: bug-IO-Prompt@rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Ingmar Pätzold <ipaetzold@gmx.de>
RT-Message-ID: <rt-3.8.HEAD-26540-1271268990-170.56568-0-0@rt.cpan.org>
Content-Length: 1887
Hi there, 1) I forget to tell that I used #!/usr/bin/perl -w Without the "-w", the error message doesn't appear and it works fine. However, I'd like to use "-w" always. 2) There's a similar message when I press Backspace in my example: "Use of uninitialized value $input in length at /usr/local/share/perl/5.10.0/IO/Prompt.pm line 413." 3) A proposal for a fix: In Prompt.pm, function "get_input", I changed the following code: The first part (at line 417 in the current version 0.997) is responsible for the Backspace message since when pressing Backspace in one_char mode, $input doesn't seem to be defined, so calling "length" would break: elsif ($next eq $cntl{ERASE} and length $input) { substr($input, -1) = ""; print {$OUT} "\b \b"; next; } The second part at line 465 throws the message I've reported yesterday when pressing any other key in one_char mode. $newlines isn't defined, so it can't print anything and would complain: else { ReadMode 'restore', $IN; print {$OUT} $newlines; return $onechar ? substr($input, 0, 1) : $input; } Fixes: in both cases, I first check whether $input or $newlines, respectively, is defined. If yes, calling "length" is safe. elsif ($next eq $cntl{ERASE} and defined $input) { # <--- if (length $input) { # <--- substr($input, -1) = ""; print {$OUT} "\b \b"; } # <--- next; } [...] else { ReadMode 'restore', $IN; print {$OUT} $newlines if (defined $newlines); # <--- return $onechar ? substr($input, 0, 1) : $input; } Hope that's useful... Cheers, Ingmar
From thoughtstream@gmail.com Wed Apr 14 14: 37:12 2010
MIME-Version: 1.0
X-Spam-Status: No, score=-7.627 tagged_above=-99.9 required=10 tests=[AWL=2.286, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8, SPF_NEUTRAL=0.686] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-26540-1271268991-1984.56568-5-0@rt.cpan.org>
X-Spam-Flag: NO
References: <RT-Ticket-56568@rt.cpan.org> <20100413191503.280800@gmx.net> <rt-3.8.HEAD-26545-1271186145-562.56568-3-0@rt.cpan.org> <4BC6065F.7090807@gmx.de> <rt-3.8.HEAD-26540-1271268991-1984.56568-5-0@rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <w2z832f158a1004141136lae58ec57s97a92a08d4d9d3e3@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -7.627
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i=@gmail.com
Authentication-Results: hipster.bestpractical.com (amavisd-new); domainkeys=pass header.sender=thoughtstream@gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id CE5D424063E for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Wed, 14 Apr 2010 14:37:11 -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 tAyvxrnzBvGm for <cpan-bug+IO-Prompt@hipster.bestpractical.com>; Wed, 14 Apr 2010 14:37:05 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 109922401F8 for <bug-IO-Prompt@rt.cpan.org>; Wed, 14 Apr 2010 14:37:04 -0400 (EDT)
Received: (qmail 18428 invoked by uid 103); 14 Apr 2010 18:37:12 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 14 Apr 2010 18:37:12 -0000
Received: from mail-yw0-f190.google.com (HELO mail-yw0-f190.google.com) (209.85.211.190) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Wed, 14 Apr 2010 11:37:08 -0700
Received: by ywh28 with SMTP id 28so228095ywh.28 for <bug-IO-Prompt@rt.cpan.org>; Wed, 14 Apr 2010 11:37:05 -0700 (PDT)
Received: by 10.150.53.13 with HTTP; Wed, 14 Apr 2010 11:36:44 -0700 (PDT)
Received: by 10.150.193.6 with SMTP id q6mr3979845ybf.83.1271270225098; Wed, 14 Apr 2010 11:37:05 -0700 (PDT)
Delivered-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
Subject: Re: [rt.cpan.org #56568] Fix proposal
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=srrs0gCTJFqZJ9ITZZB+U2lEhVVWNpaEKM+yPOcQTjXELnZCmGv9XtAHW6NwSPkoTH XyaQhm1EzPYCionwA0N/S7DVU89ABbFZV5sZZZMKDD0cSpzRPo4BM89EuEkki5Dt3Cj7 gjJBhwtkSg4AHBjaf9BPlZBz2t39zv9nrWv6w=
Return-Path: <thoughtstream@gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:received:message-id :subject:to:content-type; bh=LhXdBDTa56BE3ZuYBgwR9unPStIneVHUgQOlWp3v/Tg=; b=hUtwC0vwOdGULL/vnsBRvZJvlLE1ggv6bepE1KzFPiKYeD3Q3j1klP3XY/P6teTDDp 896OOTpcfbrU4qozaC9dzDjm64cb1pcljjn9TxoHPisZAkWatwH4BcTARC3vaYKsI4Bw Q38EkYfvwGrb69B3K+OlUByLK/f6/9iKDVFAE=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+IO-Prompt@hipster.bestpractical.com
X-RT-Mail-Extension: io-prompt
X-Google-Sender-Auth: cbd41d184d6dcdac
Sender: thoughtstream@gmail.com
Date: Wed, 14 Apr 2010 19:36:44 +0100
X-Spam-Level:
To: bug-IO-Prompt@rt.cpan.org
From: Damian Conway <damian@conway.org>
RT-Message-ID: <rt-3.8.HEAD-26547-1271270241-509.56568-0-0@rt.cpan.org>
Content-Length: 161
Thanks, Ingmar. Especially for the patch suggestions! I'm travelling at the moment, but will look into a fix as soon as I can (probably this week-end). 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.