App-GhostWork
view release on metacpan or search on metacpan
897898899900901902903904905906907908909910911912913914915916917#-----------------------------------------------------------------------------
# $tar->add_files("$tardir/$file");
#-----------------------------------------------------------------------------
open
(FH,
$file
) ||
die
"Can't open file: $file\n"
;
#'
binmode
FH;
local
$/ =
undef
;
# slurp mode
my
$data
= <FH>;
close
FH;
#-----------------------------------------------------------------------------
# Kwalitee Indicator: buildtool_not_executable core
# The build tool (Build.PL/Makefile.PL) is executable. This is bad because
# you should specify which perl you want to use while installing.
#
# How to fix
# Change the permissions of Build.PL/Makefile.PL to not-executable.
#-----------------------------------------------------------------------------
my
$tar
= Archive::Tar->new;
if
(
$file
=~ m/ (?: Build\.PL | Makefile\.PL ) \z/oxmsi) {
$tar
->add_data(
"$tardir/$file"
,
$data
, {
'mode'
=> 0664});
12341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
}
return
$_
[0];
}
}
# Test::Harness::runtests cannot work heavy load.
sub
_runtests {
my
@script
=
@_
;
my
@fail_testno
= ();
my
$ok_script
= 0;
my
$not_ok_script
= 0;
my
$total_ok
= 0;
my
$total_not_ok
= 0;
# cygwin warning:
# MS-DOS style path detected: C:/cpan/Char-X.XX
# Preferred POSIX equivalent is: /cygdrive/c/cpan/Char-X.XX
# CYGWIN environment variable option "nodosfilewarning" turns off this warning.
# Consult the user's guide for more details about POSIX paths: #'
if
(
exists
$ENV
{
'CYGWIN'
}) {
if
(
$ENV
{
'CYGWIN'
} !~ /\b nodosfilewarning \b/x) {
$ENV
{
'CYGWIN'
} =
join
(
' '
,
$ENV
{
'CYGWIN'
},
'nodosfilewarning'
);
}
}
my
$scriptno
= 0;
for
my
$script
(
@script
) {
next
if
not -e
$script
;
my
$testno
= 1;
my
$ok
= 0;
my
$not_ok
= 0;
if
(
my
@result
=
qx{$^X $script}
) {
if
(
my
(
$tests
) =
shift
(
@result
) =~ /^1..([0-9]+)/) {
for
my
$result
(
@result
) {
if
(
$result
=~ /^ok /) {
$ok
++;
}
elsif
(
$result
=~ /^not ok /) {
push
@{
$fail_testno
[
$scriptno
]},
$testno
;
$not_ok
++;
}
$testno
++;
}
if
(
$ok
==
$tests
) {
printf
(
"$script ok\n"
);
$ok_script
++;
}
else
{
printf
(
"$script Failed %d/%d subtests\n"
,
$not_ok
,
$ok
+
$not_ok
);
$not_ok_script
++;
}
}
}
$total_ok
+=
$ok
;
$total_not_ok
+=
$not_ok
;
$scriptno
++;
}
if
(
scalar
(
@script
) ==
$ok_script
) {
printf
<<'END', scalar(@script), $total_ok + $total_not_ok;
All tests successful.
Files=%d, Tests=%d
Result: PASS
END
}
else
{
<<'END';
Test Summary Report
-------------------
END
my
$scriptno
= 0;
for
my
$fail_testno
(
@fail_testno
) {
if
(
defined
$fail_testno
) {
$script
[
$scriptno
],
"\n"
;
' Failed test: '
,
join
(
', '
, @{
$fail_testno
[
$scriptno
]}),
"\n"
;
}
$scriptno
++;
}
printf
(
"Files=%d, Tests=%d\n"
,
scalar
(
@script
),
$total_ok
+
$total_not_ok
);
printf
(
"Result: FAIL\n"
);
printf
(
"Failed %d/%d test programs. %d/%d subtests failed.\n"
,
$not_ok_script
,
scalar
(
@script
),
$total_not_ok
,
$total_ok
+
$total_not_ok
);
}
}
sub
check_usascii {
my
(
$file
) =
@_
;
if
(
open
(FILE,
$file
)) {
while
(<FILE>) {
if
(not /^[\x0A\x20-\x7E]+$/) {
die
"error not US-ASCII: $file, q(;_;)bad!!"
;
}
( run in 0.389 second using v1.01-cache-2.11-cpan-26ccb49234f )