On Wed, Mar 03, 2010 at 10:28:46PM -0800, cr...@animalhead.com wrote: > 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. > ---------------------------------------------------------- > > 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?
Nothing, yet > } > > 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. Makefile.PL will grumble, but that's really just for the benefit of people running it by hand. It still writes Makefile, which contains some specially formatted comments that CPAN.pm parses out (eeuuww!) to figure out what the dependencies are. Another thing to bear in mind is what you put in META.yml. If you generate it in the normal way by doing in your dev environment: perl Makefile.PL make dist <-- this generates META.yml then it will presumably detect that the pre-reqs are already satisfied, so *neither* of them will be in the Makefile it generates, and so neither will end up in META.yml. That shouldn't cause any problems for people installing it, but for the benefit of tools that analyse META.yml, you might like to make it just default to listing JE as a pre-requisite even if the user already has it installed. -- David Cantrell | London Perl Mongers Deputy Chief Heretic Planckton: n, the smallest possible living thing