perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark S Lowe <...@twin-monolith.com>
Subject Re: Need some help hijacking the page output pipe
Date Thu, 11 Nov 2004 22:36:26 GMT
Thank you. This worked perfectly. I was also able to add test code from
chapter 4 of Writing Apache Modules with Perl and C, and add file tests.

I knew my first post to this mailing list had to be stupid. ;-)


On 11/11/04 2:21 PM, "Tom Schindl" <tomAtLinux@gmx.at> wrote:

> Mark S Lowe wrote:
> 
>> > I have a need to create my own suffix and hijack the output for page
>> > rendering code, and then re-output the page with my own OK. I have the
>> > O¹Reilly book ³Practical mod_perl² and there is a great example of
>> > this on page 114 in Chapter 4. However, the example is incomplete. The
>> > example suggests that we can intercept the request for a page, remove
>> > all the HTML tags, and re-output the page. This isn¹t exactly what I
>> > want to do, but it will server as a great architecture for my needs.
>> >
>> > I¹ve got my <Files> directive working perfectly in httpd.conf, but now
>> > I need some help intercepting the page request event, re-rendering the
>> > page, and then outputting it. I imagine this is like a three line
>> > explanation, but I can¹t seem to find it anywhere. I imagine it
>> > something like this:
>> >
>> > PerlModule MyPlatform::Converter
>> > <Files ~ "\.(pla)$">
>> > SetHandler perl-script
>> > PerlHandler MyPlatform::HTML2TextConverter MyPlatform::
>> > HTMLContentGenerator
>> > </Files>
>> >
>> > I just don¹t know how to grab the HTML page text once it gets to my
>> > module. STDIN doesn¹t have it. So where is it?
>> >
>> > Suggestions?
>> >
>> > Thanks!
>> >
>> > Mark 
> 
> Well you have to read the file yourself:
> 
> package MyPlatform::HTML2TextConverter MyPlatform:: HTMLContentGenerator;
> 
> sub handler {
> # .....
> my $content;
> 
>   local $/ = undef;
>   open( READFILE, |$r->filename| );
>   $content = <READFILE>;
>   close( READFILE );
>   # ...
> 
> }



Mime
View raw message