Skip Menu |

This queue is for tickets about the AxKit CPAN distribution.

Report information
The Basics
Id: 16771
Status: open
Priority: 0/
Queue: AxKit

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

Bug Information
Severity: Important
Broken in: 1.7
Fixed in: (no value)



Subject: Can't use the "call a sub" pattern with SimpleTaglib
Hi all! I'm working on porting TABOO to AxKit 1.7. I'm running the trunk, which hasn't changed since release, with Jörg's patches: http://garni.ch/~jwalt/axkit.diff The rest of environment is an Ubuntu Breezy system, v5.8.7 built for i486-linux-gnu-thread-multi, Linux owl 2.6.12-9-386 #1 Mon Oct 10 13:14:36 BST 2005 i686 GNU/Linux I'm trying to write a taglib to exploit the neat new way of calling tag subs in 1.7, namely where subs themselves are called from the script. I've failed to do that. Now, I've thrown out everything TABOO, and made an example as minimal as possible. This is how it looks, first the Perl module: package AxKit::XSP::Test; use Apache::AxKit::Language::XSP::SimpleTaglib; $NS = 'http://www.kjetil.kjernsmo.net/software/test'; sub taggity : XSP_attribOrChild(param) XSP_node(result) { my ($tag, $attr) = @_; return $attr->{param}; } 1; Then, the XSP: <?xml version="1.0"?> <?xml-stylesheet href="NULL" type="application/x-xsp"?> <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core" xmlns:test="http://www.kjetil.kjernsmo.net/software/test"> <html> <test:taggity param="dahut"/> </html> </xsp:page> And finally, the config: PerlModule AxKit SetHandler AxKit AxAddStyleMap application/x-xsp Apache::AxKit::Language::XSP # Turn cache off during development AxNoCache On MaxRequestsPerChild 1 AxDebugLevel 10 AxDebugTidy On AxTraceIntermediate /tmp/intermediate AxAddXSPTaglib AxKit::XSP::Test And this is the error I'm getting: [Wed Dec 28 20:00:36 2005] [warn] [client 127.0.0.1] [AxKit] Caught an exception [Wed Dec 28 20:00:36 2005] [error] [client 127.0.0.1] [AxKit] [Error] Compilation failed: syntax error at (eval 21) line 46, near "}\n )"\nsyntax error at (eval 21) line 48, at EOF\nsyntax error at (eval 21) line 53, near "} ## end do\n Apache::AxKit::Language::XSP::cache_key"\nMissing right curly or square bracket at (eval 21) line 55, at end of line\n Here's the perltidy-ied XSP script: 1 2 package Apache::AxKit::Language::XSP::ROOT::var::www::test_2exsp; 3 use Apache; 4 use Apache::Constants qw(:common); 5 use XML::LibXML; 6 Apache::AxKit::Language::XSP::Page->import( 7 qw(__mk_text_node __mk_comment_node __mk_ns_element_node __mk_element_node) 8 ); 9 use utf8; #initialize xsp namespace 10 11 #initialize xsp namespace 12 13 @Apache::AxKit::Language::XSP::ROOT::var::www::test_2exsp::ISA = 14 ('Apache::AxKit::Language::XSP::Page'); 15 16 sub xml_generator { 17 my $class = shift; 18 my ($r, $cgi, $document, $parent) = @_; 19 20 $parent = __mk_element_node($document, $parent, q|html|); 21 do { 22 { 23 my $elem = 24 $document->createElementNS( 25 q%http://www.kjetil.kjernsmo.net/software/test%, 26 q%test:result%); 27 $parent->appendChild($elem); 28 $parent = $elem; 29 } 30 __mk_text_node( 31 $document, 32 $parent, 33 "" . do { 34 { 35 my @AxKit__XSP__Test_stack = ({}); 36 my $AxKit__XSP__Test_stack = $AxKit__XSP__Test_stack[0]; 37 my ($attr_param); 38 $attr_param = q%dahut%; 39 my $_resfunc = sub { 40 AxKit::XSP::Test::taggity(q%taggity%, 41 { q%param% => $attr_param }, 42 $AxKit__XSP__Test_stack, undef); 43 }; 44 join("", $_resfunc->()); 45 } 46 ); # non xsp tag 47 $parent = $parent->getParentNode; 48 }; 49 $parent = $parent->getParentNode; 50 51 return OK; 52 } ## end do 53 Apache::AxKit::Language::XSP::cache_key(q|/var/www/test.xsp|, 1135796276); 54 I guess it should be quite clear what's wrong, that a couple of curly braces are not closed. But why escapes me entirely... The comments like ## end do are inserted by perltidy, BTW. It seems like XSP.pm runs the cache_key on line 146, but I shall not speculate who should be closing these curlies. The principle here, I find really nice, so it would be really great to get it working.
RT-Send-CC: jwalt-axkit [...] garni.ch
On closer inspection, it appears that the missing paranthesis problem was related to Jörg's patch. Reverting to AxKit SVN trunk, I'm not seeing this problem. However, I still can't the minimal example above to work. With the trunk, I get the following error: [Mon Jan 16 22:08:22 2006] [error] [client 127.0.0.1] [AxKit] [Error] Parse of '/var/www/test.xsp' failed: invalid tag: taggity (namespace: http://www.kjetil.kjernsmo.net/software/test, package AxKit::XSP::Test:: Handlers, parents ) at /usr/local/lib/perl/5.8.7/Apache/AxKit/Language/ XSP/SimpleTaglib.pm line 703.\n [Mon Jan 16 22:08:22 2006] [error] [client 127.0.0.1] [AxKit] From: / usr/share/perl5/Error.pm : 148 [Mon Jan 16 22:08:22 2006] [error] [client 127.0.0.1] [AxKit] [Backtrace] Parse of '/var/www/test.xsp' failed: invalid tag: taggity (namespace: http://www.kjetil.kjernsmo.net/software/test, package AxKit ::XSP::Test::Handlers, parents ) at /usr/local/lib/perl/5.8.7/Apache/ AxKit/Language/XSP/SimpleTaglib.pm line 703. I can't see my mistake, though... Cheers, Kjetil