Simon Perreault wrote:
You wrote on 2002-04-30 to apache-modperl about Apache::DBI not being testable
while not under mod_perl. You said this:
That's normal. You cannot test modules that use mod_perl API without
running them inside mod_perl server. I've the same problem as you've
reported. This test suite is simple broken.
...
All Apache:: module authors should be moving to use the new Apache::Test
framework soon, since it lets you test the code under running mod_perl
server and works with both versions of httpd/mod_perl.
This is exactly my situation. I develop a module which requires Apache::DBI,
so I include it in my Makefile.PL like this:
WriteMakefile(
'PREREQ_PM'= {
'Apache::DBI' = 0,
},
);
But that prints a warning because Apache::DBI can't find Apache::module(),
which is only available under mod_perl.
My question:
1) Can you tell me (or guide me toward some information) how I can properly
add Apache::DBI as a prerequisite so that it doesn't print a warning (which
is the subjet of 90% of user emails)?
2) How can I test my module running Apache::DBI with Apache::Test?
I'll answer these in reverse:
2) See http://perl.apache.org/docs/2.0/devel/testing/testing.html
Though you can really rely on it once Apache::Test is released, which
will happen when mod_perl 2.0 is released.
1) That's an interesting problem. It seems that nobody has asked this
question before. Here is my take on it. If you like this solution I'll
add it to the docs.
Makefile.PL
---
use ExtUtils::MakeMaker;
# set prerequisites
my %prereq = (
Foo = 1.56,
);
# 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} = '';
}
WriteMakefile(
NAME = 'Apache::SuperDuper',
VERSION_FROM = 'SuperDuper.pm',
PREREQ_PM = \%prereq,
# ...
);
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com