This queue is for tickets about the CSS-DOM CPAN distribution.

Report information
The Basics
Id:
54809
Status:
resolved
Priority:
Low/Low
Queue:

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

BugTracker
Severity:
Normal
Broken in:
0.08
Fixed in:
(no value)



Subject: Uninitialized value $valtypes[0] spewage from propertyparser
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. One example reproducer CSS is ext-3.1.1/resources/css/ext-all.css from http://extjs.cachefly.net/ext-3.1.1.zip (parsing that CSS is also pretty slow with CSS::DOM). 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.
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
> One example reproducer CSS is ext-3.1.1/resources/css/ext-all.css from > http://extjs.cachefly.net/ext-3.1.1.zip (parsing that CSS is also pretty > slow with CSS::DOM).
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.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.