13.06.2015 Views

Introduction to the Apache Web Server - ApacheCon

Introduction to the Apache Web Server - ApacheCon

Introduction to the Apache Web Server - ApacheCon

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Wow.<br />

15.6.2 <strong>Apache</strong>::Registry<br />

If you are certain that your program is well-written, uses strict and warnings, and does not abuse global<br />

varibles, try it under <strong>Apache</strong>::Registry<br />

Add <strong>the</strong> following configuration:<br />

Alias /perl/ /usr/local/apache/cgi-bin/<br />

<br />

SetHandler perl-script<br />

PerlHandler <strong>Apache</strong>::Registry<br />

Options +ExecCGI<br />

PerlSendHeader on<br />

<br />

Now, run:<br />

/usr/local/apache/bin/ab -n 1000 -c 5 http://localhost/perl/test.cgi<br />

Be impressed.<br />

15.7 <strong>Apache</strong> handlers with mod perl<br />

If you really want <strong>to</strong> take advantage of <strong>the</strong> power of mod perl, you should write <strong>Apache</strong> handlers using<br />

mod perl.<br />

15.7.1 Installing a mod perl handler from CPAN<br />

There are a plethora of existing mod perl handlers available for download from CPAN (<strong>the</strong> Comprehensive<br />

Perl Archive Network - http://www.cpan.org/). We’ll install one, and talk about ano<strong>the</strong>r one.<br />

Install <strong>Apache</strong>::Perldoc using:<br />

# perl -MCPAN -e shell<br />

cpan> install <strong>Apache</strong>::Perldoc<br />

92

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

Saved successfully!

Ooh no, something went wrong!