# This -*- perl -*- script writes the Makefile for libwww-perl # $Id: Makefile.PL,v 1.76 2005/11/03 17:26:39 gisle Exp $ require 5.005; use strict; use ExtUtils::MakeMaker qw(WriteMakefile prompt); use Config qw(%Config); #--- Configuration section --- my @programs_to_install = qw(lwp-request lwp-mirror lwp-rget lwp-download); my @request_aliases = qw(GET HEAD POST); #--- End Configuration - You should not have to change anything below this line # Allow us to suppress all program installation with the -n (library only) # option. This is for those that don't want to mess with the configuration # section of this file. use Getopt::Std; use vars qw($opt_n); unless (getopts("n")) { die "Usage: $0 [-n]\n"; } @programs_to_install = () if $opt_n || grep /^LIB=/, @ARGV; # Check if we should try to run tests that talk to ourself system(qq("$^X" talk-to-ourself)); if ($?) { print <t/CAN_TALK_TO_OURSELF") || die "Can't create CAN_TALK_TO_OURSELF: $!"; close(CAN_TALK_TO_OURSELF); } # Check if we should try to run the live tests open(CHANGES, "Changes") || die "Can't open Changes: $!"; my $release_date; while () { if (/^(\d{4}-\d{2}-\d{2})\D/) { $release_date = $1; last; } } close(CHANGES); die "Can't figure out release date" unless $release_date; #print "Release date: $release_date\n"; my $some_time_ago = sprintf "%04d-%02d-%02d", sub { ($_[5]+1900, $_[4]+1, $_[3])}->(localtime(time - 45 * 24*60*60)); if ($some_time_ago lt $release_date) { # Check if we have internet connection require IO::Socket; my $s = IO::Socket::INET->new(PeerAddr => "www.google.com:80", Timeout => 10, ); if ($s) { # XXX could try to send a GET to it??? close($s); print <t/live/ENABLED") || die "Can't enable: $!"; close(ENABLED); # Figure out if the compress lib works and signal that with # a file for the test suite to find. We don't want the # test script to do this 'require' itself because we want # to test that the module loads it on demand as it should. eval { require Compress::Zlib; Compress::Zlib->VERSION(1.10); open(ZLIB_OK, ">t/live/ZLIB_OK") || die "Can't create ZLIB_OK: $!"; print ZLIB_OK "$Compress::Zlib::VERSION\n"; close(ZLIB_OK); }; if ($@) { #warn $@; unlink("t/live/ZLIB_OK"); } } else { unlink("t/live/ENABLED"); } } } if (@programs_to_install) { print <VERSION(1.10); }; if ($@) { print " failed\n"; $missing_modules++; print <VERSION(3.33); }; if ($@) { print " failed\n"; $missing_modules++; print <VERSION('2.00'); }; if ($@) { print " failed\n"; $missing_modules++; print <VERSION('2.58'); }; if ($@) { print " failed\n"; $missing_modules++; print < to find a CPAN site near you. EOT print "\n"; if (@request_aliases) { require File::Copy; for (@request_aliases) { File::Copy::copy("bin/lwp-request", "bin/$_") || die "Can't copy bin/$_"; chmod(0755, "bin/$_"); push(@programs_to_install, $_); } } # Ok, now it is time to really generate the Makefile WriteMakefile( NAME => 'LWP', DISTNAME => 'libwww-perl', VERSION_FROM => 'lib/LWP.pm', EXE_FILES => [ map "bin/$_", @programs_to_install ], PREREQ_PM => { 'URI' => "1.10", 'MIME::Base64' => "2.1", 'Net::FTP' => "2.58", 'HTML::Parser' => "3.33", 'Digest::MD5' => 0, 'Compress::Zlib' => "1.10", }, 'clean' => { FILES => join(" ", map "bin/$_", @request_aliases) }, 'dist' => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, ); package MY; # What happens when we say 'make test' sub test { q( TEST_VERBOSE=0 test: all $(FULLPERL) t/TEST $(TEST_VERBOSE) ); } # Determine things that should *not* be installed sub libscan { my($self, $path) = @_; return '' if $path =~ m/\.(pl|dtd|sgml)$/; return '' if $path =~ m:\bCVS/:; return '' if $path =~ m/~$/; $path; } # Pass libwww-perl version number to pod2man sub manifypods { my $self = shift; my $ver = $self->{VERSION} || ""; local($_) = $self->SUPER::manifypods(@_); s/pod2man\s*$/pod2man --release libwww-perl-$ver/m; $_; }