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

Report information
The Basics
Id:
36221
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
Rafael.Barros [...] locaweb.com.br
Cc:
AdminCc:

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



MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,HTML_MESSAGE,SPF_PASS
Content-Class: urn:content-classes:message
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=SHA1; boundary="----=_NextPart_000_00DF_01C8C013.F00ACB50"
X-MS-Tnef-Correlator:
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 00F404D810F for <bug-IO-Prompt@rt.cpan.org>; Tue, 27 May 2008 15:08:07 -0400 (EDT)
Received: (qmail 12595 invoked from network); 27 May 2008 19:08:06 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 27 May 2008 19:08:06 -0000
Received: from hm524-second.locaweb.com.br (HELO hm524.locaweb.com.br) (200.234.205.197) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with SMTP; Tue, 27 May 2008 12:08:02 -0700
Received: (qmail 1070 invoked from network); 27 May 2008 19:08:01 -0000
Received: from unknown (HELO exchange.locaweb.com.br) (200.234.206.102) by hm524.locaweb.com.br with SMTP; 27 May 2008 19:08:01 -0000
Delivered-To: cpan-bug+IO-Prompt@diesel.bestpractical.com
Subject: Possible Bug
Return-Path: <Rafael.Barros@locaweb.com.br>
Thread-Index: AcjALRU7UJHl0HUVRgKwfiMYf2dV5Q==
X-Original-To: bug-IO-Prompt@rt.cpan.org
X-Spam-Check-BY: 16.mx.develooper.com
Date: Tue, 27 May 2008 16:07:09 -0300
X-Spam-Level: *
X-MS-Has-Attach: yes
Thread-Topic: Possible Bug
Message-Id: <B5667EEC37A08D4AAA858991A1E890A003B4CD1B@lwexchange.fabrica.locaweb.com.br>
X-Mimeole: Produced By Microsoft Exchange V6.5
To: <bug-IO-Prompt@rt.cpan.org>
From: "Rafael Barros" <Rafael.Barros@locaweb.com.br>
Content-Length: 0
content-type: application/x-pkcs7-signature; name="smime.p7s"
content-disposition: attachment; filename="smime.p7s"
Content-Transfer-Encoding: base64
Content-Length: 3361

Message body not shown because it is not plain text.

Content-Type: multipart/alternative; boundary="----=_NextPart_001_00E0_01C8C013.F00ACB50"
Content-Length: 0
content-type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: us-ascii
Content-Length: 1296
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: us-ascii
Content-Length: 3595
Hello,
 
I don't know if this is really a bug, but I have installed IO::Prompt on a Fedora 8 machine, and every call to prompt() with the -r option specified would trigger a warning:
 
Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/5.8.8/IO/Prompt.pm line 91.
the problem is shown when I try to execute the following code:
prompt( "Some message: ", -r => { "put something here>" => qr/\w+/ });
 
I looked into the code to see what was happenning, and found out that the problem was in this segment of code, in the file mentioned above:
    @data = map { $flags_alias{$_} || $_ } @data;
    for (my $i = 0 ; $i < @data ; $i++) {
        local *_ = \($data[$i]);
        if (ref eq 'HASH') {
            splice @data, $i + 1, 0, %$_;
        }
 

the problem is that, when splice is called in -r, two arguments of @data are removed from the array. If this is the last argument, the array becomes empty and $_ gets the value undef in the next iteration. When the code does ref eq 'HASH' again, the warning is sent.
 
I think that only changing the if clause to be defined $_ and ref eq 'HASH' would resolve the problem.
 
Ah, my version of IO::Prompt is 0.99.4. My Fedora has the kernel 2.6.24.7-92.fc8 and my perl is 5.8.8.
 
Thanks,
Rafael Adson Barbosa Barros
 
 


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.