Re: sending CGI ouput through a handler

2002-05-19 Thread Stas Bekman

Allen Day wrote:
>>>My::Handler takes the requested file and adds some markup to it with
>>
>>the
>>
>>>Template Toolkit if the MIMEtype of the file is text/html.  I want to
>>
>>be
>>
>>>able to use the same handler to also add markup to the output of
>>
>>executed
>>
>>>CGI.  What is the best way to do this?
>>
>>You can't feed the output of mod_cgi to mod_perl, at least not in Apache
>>1.x.  The best thing to do (at least for performance) would be to
>>rewrite the CGI so that you call it as a module from your handler.
>>Another approach would be to use Apache::Filter to grab the output from
>>PerlRun or Regsistry.  You could also sublass PerlRun or Registry and
>>add your handler code to it.
> 
> 
> So what about in Apache 2.x ?  Is there a way to address this? 

Yes, you will be able to, thanks to I/O filters. See the mod_perl 2.0 
test suite under t/filter/.

> I'm trying
> to convert a site that has lots of independent CGI to one that contains
> the output of said CGI in a set of templates.  I'd rather not have to
> make modifications to the existing CGI to bring them in.

Run them under Apache::Registry or PerlRun. Then use Apache::Filter as 
Perrin has suggested. My suggestions of using stacked handlers may work 
too with a custom subclass of Apache::RegistryNG.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com





Re: sending CGI ouput through a handler

2002-05-19 Thread Stas Bekman

Allen Day wrote:
> Okay, I realize this has probably been covered before, but I couldn't find
> anything in the archive...
> 
> I have a configuration like this:
> 
> 
>   SetHandler perl-script
>   PerlHandler My::Handler
> 
> 
> My::Handler takes the requested file and adds some markup to it with the
> Template Toolkit if the MIMEtype of the file is text/html.  I want to be
> able to use the same handler to also add markup to the output of executed
> CGI.  What is the best way to do this?
> 
> Should I set up a separate location for the CGI (I'm doing this,
> actually) ?  Are there any extra directives needed?

by CGI do you mean a script running under mod_cgi? If it's registry you 
should be able to use stacked handlers:
http://perl.apache.org/release/docs/1.0/guide/config.html#Stacked_Handlers

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: sending CGI ouput through a handler

2002-05-19 Thread Allen Day

> > My::Handler takes the requested file and adds some markup to it with
> the
> > Template Toolkit if the MIMEtype of the file is text/html.  I want to
> be
> > able to use the same handler to also add markup to the output of
> executed
> > CGI.  What is the best way to do this?
>
> You can't feed the output of mod_cgi to mod_perl, at least not in Apache
> 1.x.  The best thing to do (at least for performance) would be to
> rewrite the CGI so that you call it as a module from your handler.
> Another approach would be to use Apache::Filter to grab the output from
> PerlRun or Regsistry.  You could also sublass PerlRun or Registry and
> add your handler code to it.

So what about in Apache 2.x ?  Is there a way to address this?  I'm trying
to convert a site that has lots of independent CGI to one that contains
the output of said CGI in a set of templates.  I'd rather not have to
make modifications to the existing CGI to bring them in.

-Allen




Re: sending CGI ouput through a handler

2002-05-19 Thread Perrin Harkins

> My::Handler takes the requested file and adds some markup to it with
the
> Template Toolkit if the MIMEtype of the file is text/html.  I want to
be
> able to use the same handler to also add markup to the output of
executed
> CGI.  What is the best way to do this?

You can't feed the output of mod_cgi to mod_perl, at least not in Apache
1.x.  The best thing to do (at least for performance) would be to
rewrite the CGI so that you call it as a module from your handler.
Another approach would be to use Apache::Filter to grab the output from
PerlRun or Regsistry.  You could also sublass PerlRun or Registry and
add your handler code to it.

- Perrin