Re: Guide addition?
On 7 Oct 1999, Randal L. Schwartz wrote: "Stas" == Stas Bekman [EMAIL PROTECTED] writes: Stas yes, there are... you get a code like: Stas sub handler{ Stas print "hi\n"; Stas =pod Stas =head1 Hi Stas =cut Stas } Stas which is syntaxically incorrect, pod directives should not appear inside Stas the subs... I'll add this note too... What's incorrect about that? Pod is meant to be intertwined with Perl. Heh, did you try to run the code which includes, pod directives inside the subroutine? At least it didn't work for me with perl5.00503. Does it work for you? ___ Stas Bekman mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas Perl,CGI,Apache,Linux,Web,Java,PC at www.singlesheaven.com/stas/TULARC www.apache.org www.perl.com == www.modperl.com || perl.apache.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
Re: Guide addition?
On Fri, 8 Oct 1999, Matt Sergeant wrote: On Fri, 08 Oct 1999, Stas Bekman wrote: On 7 Oct 1999, Randal L. Schwartz wrote: "Stas" == Stas Bekman [EMAIL PROTECTED] writes: Stas yes, there are... you get a code like: Stas sub handler{ Stas print "hi\n"; Stas =pod Stas =head1 Hi Stas =cut Stas } Stas which is syntaxically incorrect, pod directives should not appear inside Stas the subs... I'll add this note too... What's incorrect about that? Pod is meant to be intertwined with Perl. Heh, did you try to run the code which includes, pod directives inside the subroutine? At least it didn't work for me with perl5.00503. Does it work for you? Works for me - perhaps you indented the pod directives? (5.00503) Yup, I was wrong - it works!!! The problem indeed was the indented pod directives :( My mistake Somehow I thought that Registry indents the code it wraps, like cperl-mode.el ... Thanks, Matt! ___ Stas Bekman mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas Perl,CGI,Apache,Linux,Web,Java,PC at www.singlesheaven.com/stas/TULARC www.apache.org www.perl.com == www.modperl.com || perl.apache.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
Guide addition?
The guide points out that __DATA__ and __END__ tokens are not allowed in Registry scripts. However, the error generated into the logfile in this case complains "Missing right bracket", and the line given is the last script line before the token. Oddly, if one *adds* a (syntactically incorrect) right bracket at that point, the script then executes OK, but DATA returns nothing. I got thrown this problem today by a colleague and spent some time scratching my head until I finally related this strange behavior to his use of __DATA__. Perhaps the Guide's troubleshooting section should include a "Spurious 'Missing right bracket'" item, asking if the user is, perchance, trying to use __DATA__ or __END__ in a Registry script.
Re: Guide addition?
On Thu, Oct 07, 1999 at 03:59:37PM +0200, Stas Bekman wrote: That's almost correct, what it does is taken a script sitting at URI /perl/test.pl: print "Content-type: text/plain\n\n" print "mod_perl rules!\n" perl actually sees it as: package Apache::ROOT::perl::test_2epl; use Apache qw(exit); sub handler { print "Content-type: text/plain\n\n" print "mod_perl rules!\n" } So if you script included __END__ or __DATA__ token like: print "Content-type: text/plain\n\n" print "mod_perl rules!\n" __END__ some junk here perl actually sees it as: package Apache::ROOT::perl::test_2epl; use Apache qw(exit); sub handler { print "Content-type: text/plain\n\n" print "mod_perl rules!\n" __END__ some junk here } Would it be possible to remove everything after __END__ before wrapping it into a function? Very often this is simply documentation. How about =pod and other tokens? Do they also break the code? Sorry, didn't use Registry so far :) Andrei --
Re: Guide addition?
So if you script included __END__ or __DATA__ token like: print "Content-type: text/plain\n\n" print "mod_perl rules!\n" __END__ some junk here perl actually sees it as: package Apache::ROOT::perl::test_2epl; use Apache qw(exit); sub handler { print "Content-type: text/plain\n\n" print "mod_perl rules!\n" __END__ some junk here } Would it be possible to remove everything after __END__ before wrapping it into a function? I guess it's possible, we are using perl, don't we? Very often this is simply documentation. How about =pod and other tokens? Do they also break the code? yes, there are... you get a code like: sub handler{ print "hi\n"; =pod =head1 Hi =cut } which is syntaxically incorrect, pod directives should not appear inside the subs... I'll add this note too... ___ Stas Bekman mailto:[EMAIL PROTECTED]www.singlesheaven.com/stas Perl,CGI,Apache,Linux,Web,Java,PC at www.singlesheaven.com/stas/TULARC www.apache.org www.perl.com == www.modperl.com || perl.apache.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com
Re: Guide addition?
"Andrei A. Voropaev" [EMAIL PROTECTED] writes: Would it be possible to remove everything after __END__ before wrapping it into a function? That requires a full-blown perl parser, to decide if __END__ is really __END__. print "Content-type: text/plain\n\n" print EOT; # Example perl code # # ... # __END__ Example 1. EOT -- Frank Cringle, [EMAIL PROTECTED] voice: (+49 2304) 467101; fax: 943357
Re: Guide addition?
make __DATA__ available to which subroutine?? only way I can think to do that effectively is: read the data, write it to a temporary file, watching our for any security concerns, and replace the standard DATA file handle with on that is opened to the temporary file that was written. cliff rayman genwax.com Robin Berjon wrote: At 16:37 07/10/1999 +0200, Stas Bekman wrote: So if you script included __END__ or __DATA__ token like: snip Would it be possible to remove everything after __END__ before wrapping it into a function? I guess it's possible, we are using perl, don't we? Or perhaps even better, remove it from the code that will get wrapped but still make DATA available ? .Robin "What I like about deadlines is the lovely whooshing sound they make as they rush past." --Douglas Adams