Skip Menu |
 

This queue is for tickets about the XML-Twig CPAN distribution.

Report information
The Basics
Id: 62204
Status: resolved
Priority: 0/
Queue: XML-Twig

People
Owner: Nobody in particular
Requestors: jmgdoc [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 3.36
Fixed in: 3.38



Subject: XML::Twig::Elt att() accessor behavior change (lvalue issue)
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 652
Download (untitled) / with headers
text/plain 652b
Since the XML::Twig::Elt att() accessor is :lvalue, its behavior as a read accessor is changed. Assuming that foo() is an arbitrary user-defined function, the first instruction below should produce the same result as the 2-line following sequence: $result = foo($elt->att('any_attribute')); $value = $elf->att('any_attribute'); $result = foo($value); It was true up to XML::Twig 3.35, but it no longer works in 3.36 and 3.37. Due to some lvalue-related side effect, the first form (i.e. when the att() call is directly used as an argument for another function call), it *creates* the attribute (with an empty string as value) if it was not defined.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-2356-1287325181-1885.62204-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 87
The issue comes with various Perl versions including 5.10.1, 5.12.0, 5.12.1, 5.12.2RC1
From xmltwig [...] gmail.com Sun Oct 17 14: 37:40 2010
MIME-Version: 1.0
X-Spam-Status: No, score=-8.061 tagged_above=-99.9 required=10 tests=[AWL=-1.852, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HK_RANDOM_ENVFROM=0.001, RCVD_IN_DNSWL_HI=-5, SPF_NEUTRAL=0.779, T_TO_NO_BRKTS_FREEMAIL=0.01] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-2363-1287324587-1063.62204-4-0 [...] rt.cpan.org>
X-Spam-Flag: NO
References: <RT-Ticket-62204 [...] rt.cpan.org> <rt-3.8.HEAD-2363-1287324587-1063.62204-4-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <AANLkTi=rtDYo_VRkDDaw66e5-foQU=X3+tjbRoX=dn7y [...] mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
X-RT-Original-Encoding: utf-8
X-Spam-Score: -8.061
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Authentication-Results: hipster.bestpractical.com (amavisd-new); domainkeys=pass header.from=xmltwig [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 8EF45240EA4 for <cpan-bug+XML-Twig [...] hipster.bestpractical.com>; Sun, 17 Oct 2010 14:37:40 -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 uZTkyLBkxcjh for <cpan-bug+XML-Twig [...] hipster.bestpractical.com>; Sun, 17 Oct 2010 14:37:38 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id F0D64240E06 for <bug-XML-Twig [...] rt.cpan.org>; Sun, 17 Oct 2010 14:37:37 -0400 (EDT)
Received: (qmail 10907 invoked by uid 103); 17 Oct 2010 18:37:37 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 17 Oct 2010 18:37:37 -0000
Received: from mail-qy0-f178.google.com (HELO mail-qy0-f178.google.com) (209.85.216.178) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Sun, 17 Oct 2010 11:37:35 -0700
Received: by qyk35 with SMTP id 35so153096qyk.9 for <bug-XML-Twig [...] rt.cpan.org>; Sun, 17 Oct 2010 11:37:32 -0700 (PDT)
Received: by 10.229.183.8 with SMTP id ce8mr2982552qcb.288.1287340651119; Sun, 17 Oct 2010 11:37:31 -0700 (PDT)
Received: by 10.229.142.79 with HTTP; Sun, 17 Oct 2010 11:37:31 -0700 (PDT)
Delivered-To: cpan-bug+XML-Twig [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #62204] XML::Twig::Elt att() accessor behavior change (lvalue issue)
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Hbwwmlj3ZgM9me/5lVe0UYIpCmaxDDX53sawplbDBaP+7EZWxZxcWXUZvbUis5BkDG qifP1a9HlSVQlXqJLHwbjq7rYJVCA3Yk5g0zdbugBiRC7FUUyEoQOH9UqKrUy9+mxnnK QbTMG/X0gpfI9ZmOlYoL/e7AGG0yB6tssWEJY=
Return-Path: <xmltwig [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=HaDB4vRZ8n//QFhD31n6xyhoDdVdA3roIK4r/500xRo=; b=qTEPpOOsDl0yKNVEcSUfPSWem4GUO04Bke3bmI166qX4DfmsqeDsEtYTwfOEOYEEkA 35PYgV0qmQlpD2lcZzdK/iLPK87aYlFFFZqlJUHUgk2FufseN5yL2XbLfeV16Ux6EoTo 2IQXK18NPMtdq4oabzgg3n1lv/aKpTb694i2k=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+XML-Twig [...] hipster.bestpractical.com
X-RT-Mail-Extension: xml-twig
Date: Sun, 17 Oct 2010 20:37:31 +0200
X-Spam-Level:
To: bug-XML-Twig [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: Michel Rodriguez <xmltwig [...] gmail.com>
RT-Message-ID: <rt-3.8.HEAD-2363-1287340661-1032.62204-0-0 [...] rt.cpan.org>
Content-Length: 1229
Download (untitled) / with headers
text/plain 1.2k
On Sun, Oct 17, 2010 at 4:09 PM, Jean-Marie Gouarné via RT <bug-XML-Twig@rt.cpan.org> wrote: Show quoted text
> Sun Oct 17 10:09:47 2010: Request 62204 was acted upon. > Transaction: Ticket created by JMGDOC >       Queue: XML-Twig >     Subject: XML::Twig::Elt att() accessor behavior change (lvalue issue) >   Broken in: 3.36 >    Severity: Important >       Owner: Nobody >  Requestors: jmgdoc@cpan.org >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=62204 > > > > Since the XML::Twig::Elt att() accessor is :lvalue, its behavior as a > read accessor is changed. Assuming that foo() is an arbitrary > user-defined function, the first instruction below should produce the > same result as the 2-line following sequence: > > $result = foo($elt->att('any_attribute')); > > $value = $elf->att('any_attribute'); > $result = foo($value); > > It was true up to XML::Twig 3.35, but it no longer works in 3.36 and > 3.37. Due to some lvalue-related side effect, the first form (i.e. when > the att() call is directly used as an argument for another function > call), it *creates* the attribute (with an empty string as value) if it > was not defined.
Oops! I'll look at this tomorrow Thanks -- mirod
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-2363-1287340661-1032.62204-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <RT-Ticket-62204 [...] rt.cpan.org> <rt-3.8.HEAD-2363-1287324587-1063.62204-4-0 [...] rt.cpan.org> <AANLkTi=rtDYo_VRkDDaw66e5-foQU=X3+tjbRoX=dn7y [...] mail.gmail.com> <rt-3.8.HEAD-2363-1287340661-1032.62204-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-26844-1298915842-1765.62204-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1187
Download (untitled) / with headers
text/plain 1.1k
On Sun Oct 17 14:37:41 2010, xmltwig@gmail.com wrote: Show quoted text
> On Sun, Oct 17, 2010 at 4:09 PM, Jean-Marie Gouarné via RT > <bug-XML-Twig@rt.cpan.org> wrote:
Show quoted text
> > Since the XML::Twig::Elt att() accessor is :lvalue, its behavior as a > > read accessor is changed. Assuming that foo() is an arbitrary > > user-defined function, the first instruction below should produce the > > same result as the 2-line following sequence: > > > > $result = foo($elt->att('any_attribute')); > > > > $value = $elf->att('any_attribute'); > > $result = foo($value); > > > > It was true up to XML::Twig 3.35, but it no longer works in 3.36 and > > 3.37. Due to some lvalue-related side effect, the first form (i.e. when > > the att() call is directly used as an argument for another function > > call), it *creates* the attribute (with an empty string as value) if it > > was not defined.
OK, there are ways to fix this, but the only clean one I found was to use Want, which is a dependency I don't want to have, as it is an XS module. Plus it implies quite a bit of processing for something as simple as getting an attribute value So I ditched att and class as lvalues latt and lclass are now lvalues. __ mirod


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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