You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rob Saunders <ro...@saunders.yourideal.co.uk> on 2004/02/10 13:23:34 UTC
[QUESTION] Newbie: Chained Handlers with variable content type
Hi,
I'm a newbie to Apache and mod_perl, so my apologies if this question is
directed at the wrong audience. (Pointers and other list recommendations
also welcome).
I'm running Apache 1.3.29 and mod_perl 1.29 on an intel based PC running
RH9 with kernel 2.6.2.
I'm trying to chain handlers to create a page with a "border" that's
dynamically generated by the handler before loading the original URI in
a "frame" in the centre of the page.
The essence of my "Stuff" package is therefore:
package Apache::Stuff ;
sub handler
{
:
:
for $handler (\&do_header, \&do_content, \&do_footer) {
$r->push_handlers(PerlHandler => $Handler);
} ;
OK;
}
sub do_header
{
# Do header stuff
return OK;
}
sub do_footer
{
# Do footer stuff;
return OK;
}
The problem I have is in defining the do_content subroutine/reference.
Basically, the handler should use the Apache configs/mime-types to
determine content and either parse it as a CGI script or simply return
the HTML. How do I call such a handler from this do_content subroutine?
Is the return an HTML string that I can simply print.... ? Or, does the
handler produce the HTML simply by being referenced and simply return
the appropriate Apache status? Am I barking up the wrong tree entirely?
Once again, my apologies if this question is not appropriate for the
list, but any redirection/advice is welcome.
TIA
Rob
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________
--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html
Re: [QUESTION] Newbie: Chained Handlers with variable content type
Posted by "Philippe M. Chiasson" <go...@cpan.org>.
Check out Apache::Sandwich if you need inspiration, it does just that.
http://search.cpan.org/~vkhera/Apache-Sandwich/
On Tue, 2004-02-10 at 12:23 +0000, Rob Saunders wrote:
> Hi,
>
> I'm a newbie to Apache and mod_perl, so my apologies if this question is
> directed at the wrong audience. (Pointers and other list recommendations
> also welcome).
>
> I'm running Apache 1.3.29 and mod_perl 1.29 on an intel based PC running
> RH9 with kernel 2.6.2.
>
> I'm trying to chain handlers to create a page with a "border" that's
> dynamically generated by the handler before loading the original URI in
> a "frame" in the centre of the page.
>
> The essence of my "Stuff" package is therefore:
>
> package Apache::Stuff ;
>
> sub handler
> {
> :
> :
> for $handler (\&do_header, \&do_content, \&do_footer) {
> $r->push_handlers(PerlHandler => $Handler);
> } ;
>
> OK;
> }
>
> sub do_header
> {
> # Do header stuff
> return OK;
> }
>
> sub do_footer
> {
> # Do footer stuff;
> return OK;
> }
>
> The problem I have is in defining the do_content subroutine/reference.
> Basically, the handler should use the Apache configs/mime-types to
> determine content and either parse it as a CGI script or simply return
> the HTML. How do I call such a handler from this do_content subroutine?
> Is the return an HTML string that I can simply print.... ? Or, does the
> handler produce the HTML simply by being referenced and simply return
> the appropriate Apache status? Am I barking up the wrong tree entirely?
>
> Once again, my apologies if this question is not appropriate for the
> list, but any redirection/advice is welcome.
>
> TIA
>
> Rob
>
> ________________________________________________________________________
> This email has been scanned for all viruses by the MessageLabs Email
> Security System. For more information on a proactive email security
> service working around the clock, around the globe, visit
> http://www.messagelabs.com
> ________________________________________________________________________
>
> --
> Reporting bugs: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html
--
--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'