Home / Documentation / General / | ||||
Preparing mod_perl modules for CPAN | ||||
|
||
This document provides information for CPAN modules developers whose modules require mod_perl.
If there are any prerequisites that need to be defined in
Makefile.PL, but require a mod_perl environment to successfully get
loaded, the following workaround can be used. The following example
will specify two prerequisites: CGI.pm
and Apache::DBI
, the
latter can be loaded only under mod_perl whereas the former can be
loaded from the command line.
file:Makefile.PL ---------------- use ExtUtils::MakeMaker; # set prerequisites my %prereq = ( 'CGI' => 2.71, ); # Manually test whether Apache::DBI is installed and add it to the # PREREQ_PM if it's not installed, so CPAN.pm will automatically fetch # it. If Apache::DBI is already installed it will fail to get loaded by # MakeMaker because it requires the mod_perl environment to load. eval { require Apache::DBI }; if ($@ && $@ !~ /Can't locate object method/) { $prereq{'Apache::DBI'} = 0.87; } WriteMakefile( NAME => 'Apache::SuperDuper', VERSION_FROM => 'SuperDuper.pm', PREREQ_PM => \%prereq, # ... the rest );
Notice that Can't locate object method is a part of the error
generated when Apache::DBI
is installed but is attempted to be
loaded outside of mod_perl, e.g. at the command line, which is the
case with Makefile.PL.
The Apache::Test
framework provides an easy way to test modules
which require mod_perl (or Apache in general), be it 1.0 or 2.0
generation. Here is the complete guide to the Apache::Test
framework.
Maintainer is the person(s) you should contact with updates, corrections and patches.
Stas Bekman [http://stason.org/]
Stas Bekman [http://stason.org/]
Only the major authors are listed above. For contributors see the Changes file.
|