Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

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

X Report information
Id: 48616
Status: patched
Left: 0 min
Priority: 0/0
Queue: XML-Twig

Owner: Nobody
Requestors: OSFAMERON <osfameron [...] cpan.org>
Cc:
AdminCc:

Severity: Important
Broken in: 3.32
Fixed in: (no value)



X History Display mode: Brief headersFull headers
#   Tue Aug 11 06:49:52 2009 OSFAMERON - Ticket created  
Subject: twig handler 'foo/*' causes syntax-error in eval
[text/plain 813b]
Ciao Michel,

If I create a twig_handler with an xpath including a '*', like so:

my $t = XML::Twig->new(
twig_handlers => {
'foo/*' => sub { },
}
);

the new() call immediately exits with what looks like errors in codegen:

wrong handler condition '' (syntax error at (eval 13) line 11, near "( ) "
Global symbol "@new_current_elts" requires explicit package name at
(eval 13) line 13.
syntax error at (eval 13) line 13, near ") {"
Global symbol "@current_elts" requires explicit package name at (eval
13) line 14.
<snip more Global symbol errors>
syntax error at (eval 13) line 26, near ";
}"
(eval 13) has too many errors

I'm uncertain if the xpath syntax I'm trying to pass is
unexpected/wrong, but I guess this error isn't intended in any case ;-)

Cheers,
Hakim
#   Tue Aug 11 10:59:08 2009 xmltwig[...]gmail.com - Correspondence added  
Subject: Re: [rt.cpan.org #48616] twig handler 'foo/*' causes syntax-error in eval
Date: Tue, 11 Aug 2009 16:58:45 +0200
To: bug-XML-Twig[...]rt.cpan.org
From: Michel Rodriguez <xmltwig[...]gmail.com>
[text/plain 1.5k]
On Tue, Aug 11, 2009 at 12:49 PM, osfameron via
RT<bug-XML-Twig[...]rt.cpan.org> wrote:
> Tue Aug 11 06:49:52 2009: Request 48616 was acted upon.
> Transaction: Ticket created by OSFAMERON
>       Queue: XML-Twig
>     Subject: twig handler 'foo/*' causes syntax-error in eval
>   Broken in: 3.32
>    Severity: Important
>       Owner: Nobody
>  Requestors: osfameron[...]cpan.org
>      Status: new
>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48616 >
>
>
> Ciao Michel,
>
> If I create a twig_handler with an xpath including a '*', like so:
>
>  my $t = XML::Twig->new(
>        twig_handlers => {
>                'foo/*' => sub { },
>          }
>  );
>
> the new() call immediately exits with what looks like errors in codegen:
>
>  wrong handler condition '' (syntax error at (eval 13) line 11, near "( ) "
>  Global symbol "@new_current_elts" requires explicit package name at
> (eval 13) line 13.
>  syntax error at (eval 13) line 13, near ") {"
>  Global symbol "@current_elts" requires explicit package name at (eval
> 13) line 14.
>  <snip more Global symbol errors>
>  syntax error at (eval 13) line 26, near ";
>  }"
>  (eval 13) has too many errors
>
> I'm uncertain if the xpath syntax I'm trying to pass is
> unexpected/wrong, but I guess this error isn't intended in any case ;-)

Ciao,

I can't believe I never tested this! Indeed the generated code is if()
{ ...} which for some reason perl doesn't quite like.
if(1) {... should work instead

Fix and tests are on their way.

Thanks for the bug report.

--
mirod



--
mirod

#   Tue Aug 11 10:59:09 2009 RT_System - Status changed from 'new' to 'open'  
#   Tue Aug 11 11:58:52 2009 MIROD - Correspondence added  
[text/plain 75b]
OK, patched version at the usual place: http://xmltwig.com/xmltwig
__
mirod
#   Tue Aug 11 11:59:05 2009 MIROD - Status changed from 'open' to 'patched'