mod_perl logo perl icon
previous page: Perl Referencepage up: General Documentationnext page: Running and Developing Tests with the Apache::Test Framework

Preparing mod_perl modules for CPAN






mod_perl2 User's Guide

mod_perl2 User's Guide

By Stas Bekman, Jim Brandt
Practical mod_perl

Practical mod_perl

By Stas Bekman, Eric Cholet
The mod_perl Developer's Cookbook

The mod_perl Developer's Cookbook

By Geoffrey Young, Paul Lindner, Randy Kobes
mod_perl Pocket Reference

mod_perl Pocket Reference

By Andrew Ford
Writing Apache Modules with Perl and C

Writing Apache Modules with Perl and C

By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

By Dave Rolsky, Ken Williams


Table of Contents

Description

This document provides information for CPAN modules developers whose modules require mod_perl.



TOP

Defining Makefile.PL Prerequisites that 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.



TOP

Writing the Test Suite

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.



TOP

Maintainers

Maintainer is the person(s) you should contact with updates, corrections and patches.

Stas Bekman [http://stason.org/]



TOP

Authors

Only the major authors are listed above. For contributors see the Changes file.






TOP
previous page: Perl Referencepage up: General Documentationnext page: Running and Developing Tests with the Apache::Test Framework