App-diff_spreadsheets
view release on metacpan or search on metacpan
t/t_TestCommon.pm view on Meta::CPAN
confess "TOOK TOO LONG ($cpusecs CPU seconds vs. limit of $maxcpusecs)\n"
if $cpusecs > $maxcpusecs;
if (wantarray) {return @result} else {return $result};
}
# Copy a file if needed to prevent any possibilty of it being modified.
# Returns the original path if the file is read-only, otherwise the path
# of a temp copy.
sub tmpcopy_if_writeable($) {
my $path = shift;
confess "$path : $!" unless stat($path);
if ( (stat(_))[2] & 0222 ) {
my ($name, $suf) = (basename($path) =~ /^(.*?)((?:\.\w{1,4})?)$/);
(undef, my $tpath) =
File::Temp::tempfile(SUFFIX => $suf, UNLINK => 1);
File::Copy::copy($path, $tpath) or die "File::Copy $!";
return $tpath;
}
$path
}
sub clean_capture_output($) {
( run in 1.008 second using v1.01-cache-2.11-cpan-49f99fa48dc )