MIME-Version: | 1.0 |
X-Spam-Status: | No, hits=-2.6 required=8.0 tests=BAYES_00 |
content-type: | text/plain; charset="utf-8"; format="flowed" |
X-Xplanation-Mailscanner-From: | paul.bijnens [...] xplanation.com |
Received: | from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id D10C74D82CB for <bug-scalar-list-utils [...] rt.cpan.org>; Thu, 29 Nov 2007 05:02:00 -0500 (EST) |
Received: | (qmail 32696 invoked by alias); 29 Nov 2007 09:35:18 -0000 |
Received: | from ip242.xplanation.com (HELO ip244.xplanation.com) (194.78.91.242) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 29 Nov 2007 01:35:16 -0800 |
Received: | from charmes.be.xplanation.com (charmes.be.xplanation.com [10.32.1.52]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ip244.xplanation.com (Postfix) with ESMTP id 5FA6820053 for <bug-Scalar-List-Utils [...] rt.cpan.org>; Thu, 29 Nov 2007 10:35:04 +0100 (CET) |
Delivered-To: | cpan-bug+scalar-list-utils [...] diesel.bestpractical.com |
User-Agent: | Thunderbird 2.0.0.9 (X11/20071031) |
Subject: | small bug in Scalar::Util |
Return-Path: | <paul.bijnens [...] xplanation.com> |
X-Original-To: | bug-scalar-list-utils [...] rt.cpan.org |
X-Spam-Check-BY: | la.mx.develooper.com |
X-Old-Spam-Status: | No |
Date: | Thu, 29 Nov 2007 10:35:03 +0100 |
X-Xplanation-Mailscanner: | Found to be clean |
Message-Id: | <474E87C7.4060000 [...] xplanation.com> |
To: | bug-Scalar-List-Utils [...] rt.cpan.org |
Content-Transfer-Encoding: | 7bit |
From: | Paul Bijnens <Paul.Bijnens [...] xplanation.com> |
X-RT-Original-Encoding: | ISO-8859-1 |
Content-Length: | 2049 |
I encountered this little bug after an upgrade of perl 5.8.8 that
fixed the pcre vulnerability on CentOS 5, which suddenly failed to
have the XS version of Scalar::Util (not sure why that happened).
Just force an install of the Scalar::Util package fixed that problem,
but while investigating what was wrong, I encountered another small bug.
In Scalar::Util the function export_fail tests this (line 28-31):
if (grep { /^(dualvar|set_prototype)$/ } @_ ) {
require Carp;
Carp::croak("$1 is only avaliable with the XS version");
}
The bug is that the reg.exp. tries to set $1, but that var goes
out of scope outside the block, resulting in an undefined variable
in the croak string and no indication that it was actually dualvar
or set_prototype that triggered the error.
test:
perl -le '@a=("A".."H");
if (grep { /^(C)$/ && print "in[$1]"} @a) { print "out[$1]" }'
Easiest fix:
if (grep { /^(?:dualar|setprototype)$/ @_ ) {
require Carp;
Carp::croak("dualvar and set_prototype only available with the XS
version");
}
And while we're at it, the previous tests in the same function could
also replace the catching parentheses "(xx|yy)" with just grouping
constructions (?:xx|yy) for a marginal speedup.
--
Paul Bijnens, xplanation Technology Services Tel +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM Fax +32 16 397.512
http://www.xplanation.com/ email: Paul.Bijnens@xplanation.com
***********************************************************************
* I think I've got the hang of it now: exit, ^D, ^C, ^\, ^Z, ^Q, ^^, *
* F6, quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt, abort, hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e, kill -1 $$, shutdown, *
* init 0, kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... *
* ... "Are you sure?" ... YES ... Phew ... I'm out *
***********************************************************************