On Fri Feb 19 16:17:32 2010, SCOP wrote:
Show quoted text> CSS::DOM::PropertyParser outputs quite a few warnings like:
>
> Use of uninitialized value $valtypes[0] in numeric ne (!=) at
> /usr/lib/perl5/vendor_perl/5.10.0/CSS/DOM/PropertyParser.pm line 220,
> <STDIN> line 1.
>
> ...for the CSS files I've tried with.
It’s more than just a warning. It behaves incorrectly, too:
use CSS'DOM'Style;
use CSS'DOM'PropertyParser;
$s = CSS'DOM'Style'parse(
"background:white",
property_parser => $CSS::DOM::PropertyParser::Default,
);
print $s->getPropertyCSSValue("background-color")->cssValueType,"\n";
In perl 5.10.0 this prints 3, which is CSS_CUSTOM. It should be 1 (CSS_PRIMITIVE_VALUE).
Show quoted text
I think the current handling of || in formats of many shorthand properties is the main cause
for the slowness. I may be able to speed it up later, but here is a workaround in the mean
time: You could parse the file without a property parser, in which case the property values
will be strings. If you need to parse a value into an object, create a new CSS::DOM::Style
object and assign it to one of its properties.
Show quoted text> Changing line 219 in PropertyParser.pm from
>
> my @valtypes = grep defined, @$valtypes;
>
> ...to:
>
> my @valtypes = grep defined, @$valtypes or return undef;
>
> ...gets rid of the warnings but I suppose it might not be the right
> thing to do.
perl 5.10.0’s $^N is more buggy that I thought (see
http://rt.perl.org/rt3/Public/Bug/Display.html?id=56194). I’ve modified the code to avoid
$^N in that perl version. Please see whether CSS::DOM 0.09 works for you.