use ExtUtils::MakeMaker; use File::Copy; use File::Spec::Functions; use File::Path; my %prereq = ( 'Test::More' => 0, ); my @libs = (); if ($^O eq 'MSWin32') { prompt(< 'Audio::Beep', VERSION_FROM => 'Beep.pm', PREREQ_PM => \%prereq, PMLIBDIRS => \@libs, ($] >= 5.005 ? ( ABSTRACT_FROM => 'Beep.pod', AUTHOR => 'Giulio Motta ' ) : () ), ); if ($jp_docs) { local $| = 1; print "Tweaking Makefile for Japanese docs... "; my ($hack, $man3_dir); open(IN, 'Makefile') or die "Cannot read Makefile: $!"; open(OUT, '> Makefile.hacked') or die "Cannot write to Makefile.hacked: $!"; while () { if (not $man3_dir and /INST_MAN3DIR\s*=\s*(\S+)/) { $man3_dir = $1; } if (/manifypods\s*:\s*/ .. /^$/) { s/Audio::Beep_jp/catfile(qw(jp Audio::Beep))/e and $hack = 1; } print OUT; } close(IN) or die "Cannot close Makefile: $!"; close(OUT) or die "Cannot close Makefile.hacked: $!"; if ($hack and $man3_dir) { mkpath(catdir($man3_dir, 'jp')); unlink('Makefile') or die "Cannot unlink Makefile: $!"; rename('Makefile.hacked', 'Makefile') or die "Cannot rename Makefile.hacked: $!"; print "DONE (install with locale support)\n"; } else { unlink 'Makefile.hacked'; print "DONE (install as Audio::Beep_jp)\n"; } }