my
$install_base_in_argv
=
grep
{ /\AINSTALL_BASE\b/ }
@ARGV
;
my
$install_base_in_perl_mm_opt
= (
defined
$ENV
{PERL_MM_OPT} ?
$ENV
{PERL_MM_OPT} :
""
) =~ /\bINSTALL_BASE\b/;
my
$has_install_base
=
$install_base_in_argv
||
$install_base_in_perl_mm_opt
|| 0;
my
$home
= home();
unless
(
$has_install_base
) {
my
$path
= catfile(
$home
,
'perlpowertools'
);
print
<<"HERE";
----------------------------------------------------------------------
You didn't specify INSTALL_BASE, so I chose $path.
You'll need to add this to PATH to be able to use the Perl Power Tools.
If you want to install them somewhere else, run Makefile.PL again
with your installation location:
perl Makefile.PL INSTALL_BASE=/where/you/want/them/to/go
Most Perl distributions don't do this for you, but I'm doing this
because some of these tools installed in the wrong places can hide
the real tools, which might cause problems. I'm being careful for
you!
----------------------------------------------------------------------
HERE
push
@ARGV
,
"INSTALL_BASE=$path"
;
}
open
my
$manifest_fh
,
'<:utf8'
,
'MANIFEST'
or
die
"Could not open MANIFEST: $!"
;
my
@exe_files
;
while
( <
$manifest_fh
> ) {
chomp
;
next
if
/\A\s*
s/\s*
next
unless
m|\Abin/|;
push
@exe_files
,
$_
;
}
close
$manifest_fh
;
my
$module
= __PACKAGE__;
(
my
$dist
=
$module
) =~ s/::/-/g;
my
$main_file
= catfile(
'lib'
,
split
/::/,
"$module.pm"
);
my
%WriteMakefile
= (
'MIN_PERL_VERSION'
=>
'5.008'
,
'NAME'
=>
$module
,
'ABSTRACT_FROM'
=>
$main_file
,
'VERSION_FROM'
=>
$main_file
,
'LICENSE'
=>
'perl'
,
'AUTHOR'
=>
'brian d foy <bdfoy@cpan.org>'
,
'EXE_FILES'
=> \
@exe_files
,
'CONFIGURE_REQUIRES'
=> {
'ExtUtils::MakeMaker'
=>
'6.64'
,
'File::Spec::Functions'
=>
'0'
,
},
'BUILD_REQUIRES'
=> {
},
'TEST_REQUIRES'
=> {
'IPC::Run3'
=>
'0'
,
'Test::More'
=>
'1'
,
},
'PREREQ_PM'
=> {
'App::a2p'
=>
'0'
,
'App::find2perl'
=>
'0'
,
'MIME::Parser'
=>
'0'
,
},
'META_MERGE'
=> {
'meta-spec'
=> {
version
=> 2 },
resources
=> {
repository
=> {
type
=>
'git'
,
url
=>
"$github.git"
,
web
=>
$github
,
},
bugtracker
=> {
web
=>
"$github/issues"
,
},
},
},
clean
=> {
FILES
=>
"$dist-*"
},
);
sub
arguments { \
%WriteMakefile
}
do_it()
unless
caller
;
sub
do_it {
my
$MM
=
'ExtUtils::MakeMaker'
;
my
$MM_version
=
eval
{
"$MM "
.
$WriteMakefile
{
'CONFIGURE_REQUIRES'
}{
'ExtUtils::MakeMaker'
} }
||
"$MM 6.64"
;
eval
"use $MM_version; 1"
or
die
"Could not load $MM_version: $@"
;
eval
"use Test::Manifest 1.21"
if
-e File::Spec->catfile(
qw(t test_manifest)
);
my
$arguments
= arguments();
my
$minimum_perl
=
$arguments
->{MIN_PERL_VERSION} ||
'5.008'
;
eval
"require $minimum_perl;"
or
die
$@;
WriteMakefile(
%$arguments
);
}
sub
home {
if
($^O eq
'MSWin32'
) {
if
(
exists
$ENV
{HOME} and
$ENV
{HOME} ) {
return
$ENV
{HOME};
}
if
(
exists
$ENV
{USERPROFILE} and
$ENV
{USERPROFILE} ) {
return
$ENV
{USERPROFILE};
}
if
(
exists
$ENV
{HOMEDRIVE} and
exists
$ENV
{HOMEPATH} and
$ENV
{HOMEDRIVE} and
$ENV
{HOMEPATH} ) {
return
catpath(
$ENV
{HOMEDRIVE},
$ENV
{HOMEPATH},
''
)
}
}
else
{
return
'~'
;
}
}
no
warnings;
__PACKAGE__;