Skip to Content
Embedding Perl in HTML with Mason
book

Embedding Perl in HTML with Mason

by Ken Williams, Dave Rolsky
October 2002
Intermediate to advanced
318 pages
8h 40m
English
O'Reilly Media, Inc.
Content preview from Embedding Perl in HTML with Mason

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_perl can 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 a mod_perl environment. If you want to try Mason out but don’t want to spend time installing and configuring mod_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 using HTML::Mason::CGIHandler to start development, then switching over to mod_perl and HTML::Mason::ApacheHandler once you’ve gotten comfortable with mod_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

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Randal Schwartz on Learning Perl

Randal Schwartz on Learning Perl

Randal L. Schwartz
Perl & LWP

Perl & LWP

Sean M. Burke
Higher-Order Perl

Higher-Order Perl

Mark Jason Dominus

Publisher Resources

ISBN: 0596002254Errata Page