I don't use Module::Install either, but here's a snippet that
does dynamic requiring using EU::MM directly:
# require JE if no JavaScript
eval 'require JavaScript';
my @optional = $@ ? ('JE' => 0.044) : ();
WriteMakefile(
<snip>
'PREREQ_PM' => {'LWP' => 5.834,
'Scalar::Util' => 0,
'URI' => 1.3,
@optional},
<snip>
);
If $ENV{AUTOMATED_TESTING} is set, you should populate @optional
with all the database drivers that you can use, and structure your
tests so that they test all the drivers that are present.
Rather than always asking the user which database, I would test
(as above) for the presence of the various database drivers. If
there's exactly one, maybe the question doesn't have to be asked.
The module that uses the Makefile.PL code above gives a choice in
its 'new' call as to which alternative submodule to use, as described
below.
A choice that can be made while learning to use your module will
probably be better informed than a choice made while installing it.
Best Regards,
cmac
-------------------------------------------------------------
$pac = HTTP::ProxyPAC->new(pacAccessor[, options]);
creates a new HTTP::ProxyPAC object.
<snip>
If 'options' are included they can be 1 or 2 key=>value pairs.
The key 'interp' can be followed by a case-independent value 'js' or
'javascript' to use the JavaScript module and the SpiderMonkey/libjs
JavaScript interpreter from Mozilla. Any other value (nominally 'je')
will use the JE module as the interpreter.
If no 'interp' option is provided, HTTP::ProxyPAC will first test
whether JavaScript is installed, and use it if so. If not it will
test whether JE is installed, and use it if so. If neither is
installed, the 'new' call will die with an error message.
-------------------------------------------------------------
On Mar 27, 2010, at 3:35 AM, Gabor Szabo wrote:
Hi,
I am trying to create a Makefile.PL using Module::Install for
Bugzilla so
it can be uploaded to CPAN. There are many issues I'll have to deal
with but
here is one that might be relevant to others.
Currently Bugzilla can be installed with either MySQL, PostgreSQL
or Oracle.
When checking for the prerequisites I'd like to let the user tell
which one she is
going to use and then make sure the relevant database driver is
installed.
How would you do this and how should that be done so automated testers
will also be able to test the package?
regards
Gabor
--
Gabor Szabo http://szabgab.com/