use strict;
use warnings;
use Fcntl qw(:seek);
-use IO::File;
+use IO::Handle;
use HTTP::Date qw(time2str);
use HTTP::Status qw(status_message);
use Plack::Util;
sub input_to_file {
my ($env) = @_;
- my $in = IO::File->new_tmpfile;
+ open(my $in, '+>', undef);
unless (defined $in) {
err($env, "could not open temporary file: $!");
return;
use HTTP::Status qw(status_message);
use HTTP::Date qw(time2str);
use Scalar::Util qw(weaken);
-use IO::File;
+use IO::Handle;
use constant {
CHUNK_START => -1, # [a-f0-9]+\r\n
CHUNK_END => -2, # \r\n
our $MAX_REQUEST_BUFFER = $ENV{GIT_HTTP_MAX_REQUEST_BUFFER} ||
(10 * 1024 * 1024);
-my $null_io = IO::File->new('/dev/null', '<');
+open(my $null_io, '<', '/dev/null') or die "failed to open /dev/null: $!";
my $http_date;
my $prev = 0;
sub http_date () {
quit($self, 413);
return;
}
- $input = IO::File->new_tmpfile;
+ open($input, '+>', undef);
} elsif (env_chunked($env)) {
$len = CHUNK_START;
- $input = IO::File->new_tmpfile;
+ open($input, '+>', undef);
}
# TODO: expire idle clients on ENFILE / EMFILE
use strict;
use warnings;
use PublicInbox::Spawn qw(popen_rd spawn);
-use IO::File;
+use IO::Handle;
use Fcntl qw(:DEFAULT SEEK_SET);
sub new {
sub _msg_to_fd {
my ($self, $msg, $tmpref) = @_;
- my $tmpfh;
my $fd;
if (my $ref = ref($msg)) {
my $fileno = eval { fileno($msg) };
return $fileno if defined $fileno;
- $tmpfh = IO::File->new_tmpfile;
+ open(my $tmpfh, '+>', undef) or die "failed to open: $!";
$tmpfh->autoflush(1);
$msg = \($msg->as_string) if $ref ne 'SCALAR';
print $tmpfh $$msg or die "failed to print: $!";
SKIP: {
use POSIX qw(dup2);
- use IO::File;
my $have_curl = 0;
foreach my $p (split(':', $ENV{PATH})) {
-x "$p/curl" or next;
my $url = 'http://' . $sock->sockhost . ':' . $sock->sockport . '/sha1';
my ($r, $w);
pipe($r, $w) or die "pipe: $!";
- my $tout = IO::File->new_tmpfile or die "new_tmpfile: $!";
+ open(my $tout, '+>', undef) or die "open temporary file: $!";
my $pid = fork;
defined $pid or die "fork: $!";
my @cmd = (qw(curl --tcp-nodelay --no-buffer -T- -HExpect: -sS), $url);