Skip Menu |

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

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

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

Bug Information
Severity: Normal
Broken in: 3.32
Fixed in: 3.33



Subject: Use of uninitialized value in eval when attribute isn't found
If warnings are turned on globally via 'perl -w', uninitialized value warnings start to appear from XML::Twig::first_elt and XML::Twig::Elt::first_descendant when an XPATH-like search is made for an element that isn't found. Examples: $element = $twig->first_elt("*[\@id='$id']"); $element = $twigroot->first_descendant("*[\@id='$id']"); If no element has an id matching $id, a warning along the lines of: Use of uninitialized value in string eq at (eval 39) line 1. is emitted. When this happens inside a loop (because, for instance, you are searching for the first element containing one out of a list of IDs), the resulting spew can cause automated smoke test reports to truncate and become useless.
Subject: Re: [rt.cpan.org #41147] Use of uninitialized value in eval when attribute isn't found
Date: Mon, 24 Nov 2008 11:46:44 +0100
To: bug-XML-Twig [...] rt.cpan.org
From: mirod <xmltwig [...] gmail.com>
Zed Pobre via RT wrote: Show quoted text
> If warnings are turned on globally via 'perl -w', uninitialized value > warnings start to appear from XML::Twig::first_elt and > XML::Twig::Elt::first_descendant when an XPATH-like search is made for > an element that isn't found.
Good catch. It's fixed in the development version. I just included a (local) $^W=0 in the eval. Thanks -- mirod