10.07.2015 Views

Beginning Web Development With Perl : From Novice to ... - Nabo

Beginning Web Development With Perl : From Novice to ... - Nabo

Beginning Web Development With Perl : From Novice to ... - Nabo

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 13 ■ PERL WEB SITES WITH MASON 265Installing MasonMason is already included with many Linux distributions, saving the need <strong>to</strong> install it fromsource. Debian, for example, includes Mason in the libhtml-mason-perl package along withother packages containing documentation and examples. Use the package search capabilitieswithin your distribution <strong>to</strong> find out if Mason is available as a package with your distribution.If Mason isn’t available with your distribution, or if you want <strong>to</strong> compile from source forsome other reason, you can download Mason from http://www.masonhq.com. Although they’renot technically required <strong>to</strong> use Mason, you’ll need Apache and mod_perl. You could get bywithout them and still use Mason, but this chapter will not cover any of those other uses. Youwill also need <strong>Perl</strong> <strong>to</strong> install Mason (though I suspect that if you didn’t have <strong>Perl</strong> by now, you mighthave had trouble with the previous 12 chapters!). Some additional modules are required <strong>to</strong>install Mason, including the following:• Class::Container• Exception::Class• File::Spec (this may already be included in your version of <strong>Perl</strong>)• Params::Validate• Scalar::UtilOptionally, you can also install the following:• Test::More• Cache::CacheYou can obtain these modules from your favorite CPAN mirror.■Note Apache::Request and CGI.pm aren’t technically required <strong>to</strong> compile the Mason software, but theyare required if you’d like <strong>to</strong> follow along with the examples in this chapter, and you’ll likely need them forprogramming Mason anyway. (You likely have them both already.)Compiling MasonMason is downloaded as a gzipped tar archive and will have a filename like HTML-Mason-N.NN.tar.gz, where NNN is the version number, such as 1.28. Unzip and unarchive the file:tar -zxvf HTML-Mason-1.28.tar.gzand change in<strong>to</strong> the HTML-Mason-N.NN direc<strong>to</strong>ry:cd HTML-Mason-1.28Once you’re inside the direc<strong>to</strong>ry, run the <strong>Perl</strong>-style Makefile.PL by typingperl Makefile.PLThis program will check for prerequisites and output the following:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!