Skip Menu |

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

Report information
The Basics
Id: 28718
Status: open
Priority: 0/
Queue: CSS-Tiny-Style

People
Owner: Nobody in particular
Requestors: tokuhirom+cpan [...] gmail.com
Cc:
AdminCc:

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



Subject: infinite loop
follow code makes infinite loops at CSS::Tiny::Style::_sel_arr. my $style = CSS::Tiny::Style->new('a:hover'); $style->selarr;
From: kamensky [...] cpan.org
On Tue Aug 07 11:54:11 2007, TOKUHIROM wrote: Show quoted text
> follow code makes infinite loops at CSS::Tiny::Style::_sel_arr. > > my $style = CSS::Tiny::Style->new('a:hover'); > > $style->selarr; >
I attach a patch to fix it (and some other bugs.)
--- lib/perl5/site_perl/5.10.0/CSS/Tiny/Style.pm.orig 2007-12-26 10:49:07.419989000 -0500 +++ lib/perl5/site_perl/5.10.0/CSS/Tiny/Style.pm 2007-12-26 12:11:53.683755000 -0500 @@ -157,6 +157,7 @@ # the next argument is an element or a listref of elements my @el = shift; if (ref $el[0] eq 'ARRAY') { @el = @{$el[0]} }; + my ($sel, $rel, @sel); if (@_) { ( @@ -181,7 +182,7 @@ if ($self->element_match($_, $sel)) { # if element matches, check his relatives if ($rel) { - my $rellist = $_->$rel; + my $rellist = $rel eq 'lineage' ? [$_->$rel] : $->$rel; $match = $self->match($rellist, @sel) } else { $match = 1; @@ -284,7 +285,7 @@ my ($tag, $op); - s/([a-zA-Z0-9.\#\*]+)\s*$//; $tag = $1; + s/(\@page|[a-zA-Z0-9.\#\*]+)\s*$//; $tag = $1; $op = $1 if (s/(\s*[+>]*\s*)$//); @@ -295,6 +296,10 @@ /\>/ && do { push @d, 'parent'; last; }; /^\s+$/ && do { push @d, 'lineage'; last; }; } + unless ( $tag or $op ) { + carp "Unable to parse selector: '$_'"; + last; + } } return @d; }