use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. require 5.004; use strict; my $prerequisites = < Possible options are: --noprompt Disable interactive dialog --alltests Perform extra testing --help, -? Display this help text [Do not] install prerequisites for appropriate module: EOI # Create config parameters using module names and expand help text # We will create a hash (%config) that has each module => (1|0) for install my(%options, %config); foreach (split "\n", $prerequisites) { next unless /\((SOAP::[\w:]+).+\[(yes|no)\]/; my $module = do { (my $t = $1) =~ s/::/-/g; $t }; my $shortcut = do { (my $t = $module) =~ s/SOAP-(?:Transport-)?//; $t }; $config{$1} = $2 eq 'yes'; $options{"install-$module|$shortcut!"} = \$config{$1}; $helptext .= sprintf " --[no]install-%-28s --[no]%s\n", $module, $shortcut; } GetOptions( 'prompt!' => \(my $prompt = 1), 'alltests!' => \(my $alltests = 0), 'help|?' => \(my $help = 0), %options, ); $help and print($helptext), exit; # Now update prerequisites according to command line options $prerequisites =~ s/\((SOAP::[\w:]+)([^\)]*)\)(.+)\[(yes|no)\] /sprintf"(%s%s)%s[%s]",$1,$2,$3,$config{$1}?'yes':'no'/egx; print < 'yes') =~ /^\s*y/i : 1; foreach (split /(^[-\s]+$)/m, $prerequisites) { print unless $auto; if (/SOAP::/m && (/\s+(yes)\s*$/m || /\[(yes|no)\]/ && ($auto || ExtUtils::MakeMaker::prompt("\nDo you plan to use this module?", $1) =~ /^\s*(y)/i))) { %prerequisites = (%prerequisites, map {/\s+/? split : ($_ => 0)} /^\s{20,}([\w:]+(?:\s+[\d.]+)?)/mg) if $1 =~ /^y/; } } my $noncoretests = $prompt ? ExtUtils::MakeMaker::prompt(' During "make test" phase we may run tests with several SOAP servers that may take long and may fail due to server/connectivity problems. Do you want to perform these tests in addition to core tests?', $alltests ? 'yes' : 'no') =~ /^\s*(y)/i : $alltests; my $tests = join ' ', glob ($noncoretests ? 't/*.t' : 't/0*.t'); WriteMakefile( 'NAME' => 'SOAP::Lite', 'VERSION_FROM' => 'lib/SOAP/Lite.pm', 'PREREQ_PM' => \%prerequisites, 'EXE_FILES' => ['bin/SOAPsh.pl', 'bin/XMLRPCsh.pl', 'bin/stubmaker.pl'], test => {TESTS => $tests}, );