On Fri Oct 09 02:26:55 2009, ANDK wrote:
Show quoted text> After a bisect that pointed me to patch fae667d (p4raw-id:
> //depot/perl@30104) I knew it would be a regex with alteration. With
> the following patch I made the tests pass on 5.8:
>
> --- ../CSS-LESSp-0.03-FiMxvF/lib/CSS/LESSp.pm 2009-10-01
> 08:20:11.000000000 +0200
> +++ lib/CSS/LESSp.pm 2009-10-09 08:11:07.000000000 +0200
> @@ -69,7 +69,7 @@
> # expression (+,-,*,/)
> if ( $value =~
> /(\d+)\s*(px|pt|em|%)*\s*(\+|\*|\/)\s*((\d+)\s*(px|pt|em|%)*|\d+)/ or
> $value =~ /(\d+)\s*(px|pt|em|%)*\s*(\-)\s+((\d+)\s*(px|pt|em|%)*|\d+)/ ) {
> my $eval = $value;
> - my $removed = $1 if $eval =~ s/(px|pt|em|%)//g;
> + my $removed; $removed = $1 if $eval =~ m/(px|pt|em|%)/; $eval
=~
Show quoted text> s/(px|pt|em|%)//g;
> if ( $eval !~ /[a-z]/i and $eval = eval($eval) ) {
> $eval .= "$removed" if $eval and $removed;
> $value = $eval;
>
>
>
> So here is an example to try out that works only since 5.10:
>
> my $eval = "35% ";
> print $1 if $eval =~ s/(x|%)//g;
>
> It prints '%' with 5.10 and nothing with 5.8.
>
> Thanks for the puzzle;)
I'll integrate the patch soon. Thanks for your help. I have no time recently to update this
module... I'm glad real people are using it!