in reply to Re: source filtering and mod_perl2
in thread source filtering and mod_perl2
Listing test2.cgi ----------------- #!/usr/bin/perl use Modern::Perl; use aXML2; my $stash = { title => "bob's bit's emporium" }; sub a { " foo " } <aXML> <html> <head> <title>[my]stash->{'title'}[/]</title> </head> <body> <perl>print "hi";</perl> (a)b(/) </body> </html> </aXML> listing aXML2.pm ---------------- package aXML2; use Filter::Util::Call; my $header = 'print "Content-type: text/html\n\n";'; sub import { my ($type) = @_; my ($ref) = []; filter_add(bless $ref); } sub filter { my ($self) = @_; my ($status); do { if (s@<aXML>@$header print qq\@@s) { $header = " "; } s@</aXML>@\@;@s; s@<perl>@\@;@s; s@</perl>@print qq\@@s; s@\(([^\(]*?)\)([^\(]*?)\(/\)@\@; print &$1('$2'); print qq +\@@s; s@\[my\](.*?)\[/\]@\$$1@gs; } if $status = filter_read() > 0; $status; } 1;
test2.cgi works under plain CGI but not under mod_perl using :
Listing httpd.conf ------------------ AddHandler cgi-script .cgi PerlModule Apache::DBI <Files *.pl> SetHandler perl-script PerlHandler ModPerl::Registry PerlOptions +ParseHeaders Options +ExecCGI Order allow,deny Allow from all </Files>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: source filtering and mod_perl2
by Corion (Patriarch) on Aug 28, 2011 at 21:20 UTC | |
by Logicus (Initiate) on Aug 28, 2011 at 22:11 UTC | |
by Corion (Patriarch) on Aug 29, 2011 at 08:36 UTC | |
by Logicus (Initiate) on Aug 29, 2011 at 13:44 UTC |
In Section
Seekers of Perl Wisdom