Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

geoff (2013)

geoff
  reversethis-{gro ... om} {ta} {ffoeg}
http://www.modperlcookbook.org/

see http://www.modperlcookbook.org/~geoff/ [modperlcookbook.org] for personal information, links to presentations, GPG key, and so on.

Journal of geoff (2013)

Tuesday September 16, 2003
08:58 AM

<!-- #perl --> support for Apache 2.0

[ #14734 ]
yesterday, I released Apache::IncludeHook to CPAN. it provides support for #perl SSI tags in the following formats:

<!--#perl sub="My::PrintArgs" -->
<!--#perl arg="fee" sub="My::PrintArgs" arg="fie" -->
<!--#perl arg="foe" sub="My::PrintArgs::handler" -->
<!--#perl arg="fum" sub="My::PrintArgs->method_handler" -->
<!--#perl arg="I smell" sub="sub { my $r = shift; print @_ }" -->


the coolish thing is the interface. as you may already know, mod_include is an output filter in Apache 2.0. for custom tags, this means that the tag implementation also needs to be a filter. however, rather than require that #perl code understand the filtering API, I made it possible to write to an output filter using $r->print() or just print(). it was pretty cool to see this idiom

sub new {

 my ($class, $r) = @_;

 return tie *STDOUT, $class, $r;
}

sub TIEHANDLE {

 my ($class, $r) = @_;

 return bless { r => $r }, $class;
}


working in mod_perl 2.0 as well.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.