Hi module authors,

The author of HTTP::ProxyPAC has graciously made me a co-maintainer.

What I want to do is to allow the module to be based on either of 2
JavaScript interpreters, JavaScript (based on Mozilla libjs) or JE,
so that people who have already started with H:PP version 0.1 and
JavaScript can go along in that way, while new users (including users of
a module of mine) aren't subject to the pain of installing libjs by hand.

The work in the module itself is easy, just run one or two eval "require ..."
as I've done in Makefile.PL below, and use what's available.  It's
dynamically installing a module that I'm sending this to ask about.

Here is the Makefile.PL that I've worked up so far.  Note the question
in the middle.  Then please read on below the listing.
----------------------------------------------------------
use strict;
use warnings;
use lib 'inc';
use Devel::CheckLib 'check_lib';

my @enginePrereq = ();
my @JS = ('JavaScript' => 1.16);
my @JE = ('JE'         => 0.042);

eval "require JavaScript";
if ($@) {
  eval "require JE";
  if ($@) {
    # search for libjs
    @enginePrereq = check_lib(lib => ['libjs']) ? @JS
                                                : @JE;
  } elsif       ($JE::VERSION < $JE[1]) {...@engineprereq = @JE}
} elsif ($JavaScript::VERSION < $JS[1]) {...@engineprereq = @JS}

if (@enginePrereq) {
   # what do I do here to make JS or JE be installed?
}

use ExtUtils::MakeMaker;
WriteMakefile(
    'AUTHOR'         => 'Tatsuhiko Miyagawa <miyag...@bulknews.net>',
    'BUILD_REQUIRES' => {'Test::More'    => 0.32},
    'NAME'           => 'HTTP::ProxyPAC',
    'PREREQ_PM'      => {'LWP'           => 5.6,
                         'Scalar::Util'  => 0,
                         'URI'           => 1.3,
                         @enginePrereq},  # all this does is complain
    'VERSION_FROM'   => 'lib/HTTP/ProxyPAC.pm'
);
------------------------------------------------------------------

All that putting @enginePrereq in the PREREQ_PM array does (in a
standalone, non-CPAN-drive case) is make EU::MM complain that one
of the prerequisites have not been satisfied. If CPAN is sitting outside this process waiting for the execution of Makefile.PL to complete, I can't
fire up another CPAN process to install JS or JE, they would have a lock
conflict.

Is there an elegant solution to this?

cmac


Reply via email to