in reply to XML::Twig handlers weirdness?
I call perl bug. The following also demonstrates the odd behavior. Interestingly, the substr(lc($str),0) in the second iteration is limited to the length of the (correct) substr(lc($str),0) in the first iteration.
e.g. with an argument of 'a:bc', the 'bc' is cut down to 'b' (the length of 'a'). For 'ab:cde' or 'ab:cdefgh', the 'cde' and 'cdefgh' are cut down to 'cd' (the length of 'ab').
#!/usr/bin/perl -l use strict; use warnings; use Encode qw/_utf8_on/; for my $str (split /:/, shift||'a:bc') { _utf8_on($str); print "$str\t", substr(lc($str), 0); # use Devel::Peek; Dump substr(lc($str),0); }
For someone familiar w/ perlguts (not me), uncomment the Devel::Peek line.
UPDATE: Expected output for input of x:yz is:
, but due to bugginess, it's:x x yz yz
x x yz y
Also, the problem presents in v5.8.7 linux, but not in v5.8.0 solaris, if those are helpful data points.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Twig handlers weirdness?
by mirod (Canon) on Feb 21, 2006 at 20:14 UTC | |
by benizi (Hermit) on Feb 27, 2006 at 03:27 UTC |