use
vars
qw{$VERSION @ISA $ISCORE}
;
BEGIN {
$VERSION
=
'1.04'
;
@ISA
=
'Module::Install::Base'
;
$ISCORE
= 1;
}
sub
install_share {
my
$self
=
shift
;
my
$dir
=
@_
?
pop
:
'share'
;
my
$type
=
@_
?
shift
:
'dist'
;
unless
(
defined
$type
and
$type
eq
'module'
or
$type
eq
'dist'
) {
die
"Illegal or invalid share dir type '$type'"
;
}
unless
(
defined
$dir
and -d
$dir
) {
Carp::croak(
"Illegal or missing directory install_share param: '$dir'"
);
}
my
$S
= ($^O eq
'MSWin32'
) ?
"\\"
:
"\/"
;
my
$root
;
if
(
$type
eq
'dist'
) {
die
"Too many parameters to install_share"
if
@_
;
$root
=
"\$(INST_LIB)${S}auto${S}share${S}dist${S}\$(DISTNAME)"
;
}
else
{
my
$module
= Module::Install::_CLASS(
$_
[0]);
unless
(
defined
$module
) {
die
"Missing or invalid module name '$_[0]'"
;
}
$module
=~ s/::/-/g;
$root
=
"\$(INST_LIB)${S}auto${S}share${S}module${S}$module"
;
}
my
$manifest
= -r
'MANIFEST'
? ExtUtils::Manifest::maniread() :
undef
;
my
$skip_checker
=
$ExtUtils::Manifest::VERSION
>= 1.54
? ExtUtils::Manifest::maniskip()
: ExtUtils::Manifest::_maniskip();
my
$postamble
=
''
;
my
$perm_dir
=
eval
(
$ExtUtils::MakeMaker::VERSION
) >= 6.52 ?
'$(PERM_DIR)'
: 755;
File::Find::find({
no_chdir
=> 1,
wanted
=>
sub
{
my
$path
= File::Spec->abs2rel(
$_
,
$dir
);
if
(-d
$_
) {
return
if
$skip_checker
->(
$File::Find::name
);
$postamble
.=
<<"END";
\t\$(NOECHO) \$(MKPATH) "$root${S}$path"
\t\$(NOECHO) \$(CHMOD) $perm_dir "$root${S}$path"
END
}
else
{
return
if
ref
$manifest
&& !
exists
$manifest
->{
$File::Find::name
};
return
if
$skip_checker
->(
$File::Find::name
);
$postamble
.=
<<"END";
\t\$(NOECHO) \$(CP) "$dir${S}$path" "$root${S}$path"
END
}
},
},
$dir
);
$self
->postamble(
<<"END_MAKEFILE");
config ::
$postamble
END_MAKEFILE
$self
->build_requires(
'ExtUtils::MakeMaker'
=>
'6.11'
);
$self
->no_index(
directory
=>
$dir
);
}
1;