#!/perl -w
use
5.010;
sub
has_shebang {
my
$fname
=
shift
;
open
my
$fh
,
'<'
,
$fname
or
die
"Can't open '$fname': $!"
;
my
$line
= <
$fh
>;
close
$fh
;
return
$line
=~ /^\
}
require
'./test.pl'
;
if
( $^O eq
"MSWin32"
) {
skip_all(
"-x on MSWin32 only indicates file has executable suffix. Try Cygwin?"
);
}
if
( $^O eq
"VMS"
) {
skip_all(
"Filename case may not be preserved and other porting issues."
);
}
if
( $^O eq
"vos"
) {
skip_all(
"VOS combines the read and execute permission bits."
);
}
if
(
$Config
{usecrosscompile} ) {
skip_all(
"Not all files are available during cross-compilation"
);
}
plan(
'no_plan'
);
my
%exe_list
=
map
{
$_
=> 1 }
map
{
my
(
$f
) =
split
;
glob
(
"../$f"
) }
grep
{
$_
!~ /\A
map
{
split
"\n"
}
do
{
local
(
@ARGV
, $/) =
'../Porting/exec-bit.txt'
; <> };
$ExtUtils::Manifest::Quiet
= 1;
my
@manifest
=
sort
keys
%{ maniread(
"../MANIFEST"
) };
for
my
$f
(
map
{
"../$_"
}
@manifest
) {
next
unless
-x
$f
;
ok( has_shebang(
$f
),
"File $f has shebang"
);
ok(
$exe_list
{
$f
},
"tarball will chmod +x $f"
)
or diag(
"Remove the exec bit or add '$f' to Porting/exec-bit.txt"
);
delete
$exe_list
{
$f
};
}
ok( !
%exe_list
,
"Everything in Porting/exec-bit.txt has +x in repo"
)
or diag(
"Files missing exec bit:\n "
.
join
(
"\n "
,
sort
keys
%exe_list
) .
"\n"
);