develooper Front page | perl.perl5.porters | Postings from September 2011

[perl #92436] Filter::Simple $pod_or_DATA regex fails

Thread Next
From:
Father Chrysostomos via RT
Date:
September 10, 2011 00:09
Subject:
[perl #92436] Filter::Simple $pod_or_DATA regex fails
Message ID:
rt-3.6.HEAD-31297-1315638569-1754.92436-15-0@perl.org
On Tue Jun 07 18:34:06 2011, chm wrote:
> Using the FILTER_ONLY with code_no_comments fails for the following
> code because the $pod_or_DATA regex does not correctly capture the
> pod sequence.  It appears to capture up to the = of the last =cut
> leaving a naked cut behind which is parses as an undeclared sub.
> 
>  > my $dims = pdl($var->dims);
>  > ($t = $dims->(0)) .= 1;
>  > $rpt = $dims->prod;
>  >
>  > =begin WHENCOMPLEXVALUESWORK
>  >
>  > if( UNIVERSAL::isa($var,'PDL::Complex') ) {
>  >       $rpt = $var->dim(1);
>  >       $t = 'complex'
>  > } else {
>  >       $t = type $var;
>  > }
>  >
>  > =end WHENCOMPLEXVALUESWORK
>  >
>  > =cut
>  >
>  > barf "Error: wfits() currently can not handle PDL::Complex arrays
> (column $colnames[$i])\n"
>  > if UNIVERSAL::isa($var,'PDL::Complex');
>  > $t = $var->type;
>  >
>  > $t = $bintable_types{$t};
> 
> Changing the following line in the regex from
> 
>      | ^=begin \s* (\S+) .*? \n=end \s* \1 .*? $EOP
> 
> to
> 
>      | ^=begin \s+ (?:\S+) .*? \n=end \s* \1 .*? $EOP =cut \s*? $EOP
> 
> appears to fix the problem.  I am not sure that the fix
> completely handles all edge cases but I believe it is a
> step to the correct solution.

I’ve fixed it with commit 0b2be16900832ccd9de494ff538bf070d8623089.

(The other issue you reported I have not fixed.  I believe it’s a
Text::Balanced bug.)


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About