Chapter 9. Mason and CGI
Although mod_perl is pretty cool,
it’s not the only way to use Mason to build a web
site. In fact, plenty of times it’s more advisable
to use CGI than mod_perl, as we describe in this
chapter. If you find yourself in such a situation,
you’re in luck — Mason works just fine under
CGI, and special care has gone into making sure the cooperation is
smooth. The HTML::Mason::CGIHandler module
provides the glue necessary to use Mason in most common CGI
environments.
CGI-Appropriate Situations
Before we get into the details of how to set up Mason under CGI,
let’s think about why you might
want to use this setup. After all, isn’t
mod_perl supposed to be
better than CGI? Well, yes and no. As in most
things, context is everything. The following factors may conspire to
make you choose clunky old
CGI over
clunky new mod_perl in a particular situation:
- Need instant gratification
Installing
mod_perlcan be somewhat difficult if you’ve never done it before (heck, even if you have done it before), and it can take a while to get used to the peculiarities of developing in amod_perlenvironment. If you want to try Mason out but don’t want to spend time installing and configuringmod_perl(or you don’t want to wait for the person who’s going to come install it for you), you may be interested in usingHTML::Mason::CGIHandlerto start development, then switching over tomod_perlandHTML::Mason::ApacheHandleronce you’ve gotten comfortable withmod_perl.- Must share hosting environments ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access