perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Peters <mpet...@plusthree.com>
Subject Re: Using Apache Module for Homepage Handler
Date Tue, 28 Mar 2006 13:01:19 GMT


James wrote:
> [sorry for length, I've been wanting to ask this for a while :)]
> 
> Hello,
> 	I'm a bit new to coding with mod_perl (and I _am_ new to this list), 
> and I have a question. :)  I have it set up now where my default page 
> is index.pl, and I've got some other links (e.g. contact/about/faq) 
> that are also generated from perl scripts. (I have a <Files *.pl> 
> directive that puts all .pl files through ModPerl::Registry)  Reason 
> they're mod_perl generated is that the index does a lot, and if the 
> user is logged on it displays one thing; otherwise, something else, 
> etc.  I have other normal mod_perl modules that act as handlers for 
> certain URIs, based on <Location> directives.  But the more I learn, 
> the more I see that I should probably stray away from individual files. 
> (maybe not?)  But I always wondered how people set-up mod_perl do deal 
> with different links on a large site: does one use <Location> for every 
> link possible? (yeah yeah, I know)  Well, for the modules I learned how 
> to parse the path_info and take from there what link needs to be 
> processed.  So I decided to make my default homepage a mod_perl module.  
> Then I could parse path_info and dispatch to the appropriate 
> 'handler' (or page renderer function) for things like [contact|faq|
> about].  Is that normal? 

Yes it is quite normal actually. Look at Apache::Dispatch, or if you
want to learn something new (CGI::Application) try
CGI::Application::Dispatch. In the interest of full disclosure I'm the
author of CGI::Application::Dispatch, so I am partial to it :)


-- 
Michael Peters
Developer
Plus Three, LP


Mime
View raw message