Skip Menu |
 

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

Report information
The Basics
Id: 235
Status: resolved
Priority: 0/
Queue: XML-XPath

People
Owner: Nobody in particular
Requestors: chadh [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.12
Fixed in: (no value)



MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
Subject: XPath 'sum' fails due to missing to_number method
Content-Type: multipart/mixed; boundary="----------=_1012418158-19465-13"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 733
Download (untitled) / with headers
text/plain 733b
Distribution: XML::XPath-1.12 Perl: 5.6.0 OS: Linux hawking 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown See attached test case. The expected results are: count of BBB is 3 sum of BBB is 22 Under XML::XPath 1.12 (and previous versions, I assume), the actual results are: count of BBB is 3 No such method to_number in XML::XPath::Node::ElementImpl at blib/lib/XML/XPath/Function.pm line 360 I added a simple to_number method to my local Element.pm. Patch below: --- XPath/Node/Element.pm.orig Wed Mar 7 12:46:40 2001 +++ XPath/Node/Element.pm Wed Jan 30 15:28:20 2002 @@ -419,6 +419,10 @@ return $string; } +sub to_number { + return XML::XPath::Number->new(shift->string_value); +} + 1; __END__
Content-Type: application/octet-stream; name="test-sum"
Content-Disposition: inline; filename="test-sum"
Content-Transfer-Encoding: base64
Content-Length: 406
Download test-sum
application/octet-stream 406b

Message body not shown because it is not plain text.

MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
From: Roland Moriz
Content-Type: multipart/mixed; boundary="----------=_1021499816-19707-0"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 447
Download (untitled) / with headers
text/plain 447b
this also affects: my $xp = XML::XPath->new(filename => 'config/r2x.xml'); my $nodeset = $xp->find('/config/export/users/user[@status > 0 ]/@id'); ... No such method to_number in XML::XPath::Node::AttributeImpl at /usr/local/lib/perl5/site_perl/5.6.1/XML/XPath/Expr.pm line 452 I temporarily fixed that by adding the mention fix also to Node/Attribute.pm. I also wrote an email to Matt (Author of it) to fix this. thanks, regards, Roland
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
X-RT-Original-Encoding: iso-8859-1
Content-Length: 135
Download (untitled) / with headers
text/plain 135b
Fixed in CVS. to_number put in Node.pm (so it'll work for all) and sum() function fixed so it doesn't try and cross sum multiple nodes.


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.