
Our platform support policy states that we require "versions of dependencies which are generally accepted as stable and supportable, e.g., in line with the version used by other long-term-support distributions". Of Debian, Ubuntu, RHEL, and SLES, the four most common distributions that provide LTS versions, the version with mainstream long-term security support with the oldest Perl is 5.26.0 in SLES 15.6. This is a major upgrade, since Perl 5.8.1, according to the Perl documentation, was released in September of 2003. It brings a lot of new features that we can choose to use, such as s///r to return the modified string, the postderef functionality, and subroutine signatures, although the latter was still considered experimental until 5.36. This change was made with the following one-liner, which intentionally excludes modifying the vendored modules we include to avoid conflicts: git grep -l 'use 5.008001' | grep -v 'LoadCPAN/' | xargs perl -pi -e 's/use 5.008001/require v5.26/' Use require instead of use to avoid changing the behavior as the latter enables features and the former does not. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Taylor Blau <me@ttaylorr.com>
37 lines
865 B
Perl
37 lines
865 B
Perl
require v5.26;
|
|
use strict;
|
|
use warnings;
|
|
|
|
my $body_filename = $ARGV[0];
|
|
my @command = @ARGV[1 .. $#ARGV];
|
|
|
|
# read data
|
|
my $body_size = -s $body_filename;
|
|
$ENV{"CONTENT_LENGTH"} = $body_size;
|
|
open(my $body_fh, "<", $body_filename) or die "Cannot open $body_filename: $!";
|
|
my $body_data;
|
|
defined read($body_fh, $body_data, $body_size) or die "Cannot read $body_filename: $!";
|
|
close($body_fh);
|
|
|
|
# write data
|
|
my $pid = open(my $out, "|-", @command);
|
|
{
|
|
# disable buffering at $out
|
|
my $old_selected = select;
|
|
select $out;
|
|
$| = 1;
|
|
select $old_selected;
|
|
}
|
|
print $out $body_data or die "Cannot write data: $!";
|
|
|
|
$SIG{ALRM} = sub {
|
|
kill 'KILL', $pid;
|
|
die "Command did not exit after reading whole body";
|
|
};
|
|
alarm 60;
|
|
|
|
my $ret = waitpid($pid, 0);
|
|
if ($ret != $pid) {
|
|
die "confusing return from waitpid: $ret";
|
|
}
|