Skip Menu |

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

Report information
The Basics
Id: 48613
Status: new
Priority: 0/
Queue: Test-XML-Easy

Owner: Nobody in particular
Requestors: zefram [...]

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

Subject: $xml10_s_rx usage in Test::XML::Easy
Date: Tue, 11 Aug 2009 10:14:13 +0100
To: bug-Test-XML-Easy [...]
From: Zefram <zefram [...]>
Download (untitled) / with headers
text/plain 817b
Test::XML::Easy uses $xml10_s_rx (from XML::Easy::Syntax) slightly incorrectly. $xml10_s_rx matches a *sequence of one or more* whitespace chars, but you've treated it as if it matched *exactly one* whitespace char, risking exponential explosion in backtracking. Also, two of the three places that you do whitespace matching will match on an empty string and do a null substitution, whereas it would be more efficient to only match a non-empty string. Incidentally, you should be using the /o modifier to avoid repeated interpolation. So where you have $comp_got_text =~ s/ \A (?:$xml10_s_rx)* //x; you should instead have $comp_got_text =~ s/ \A $xml10_s_rx //ox; and likewise the other substitutions should be $comp_got_text =~ s/ $xml10_s_rx \z//ox; $comp_got_text =~ s/ $xml10_s_rx / /ogx; -zefram

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

Please report any issues with to