X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FTmpfile.pm;h=3040dd77d457d02f4517088edcad4f4cf858228f;hb=23af251dd607c4e75ab1e68063f2c885c48cc035;hp=28e87f882efcb144df8b8dfc684ce1942a231278;hpb=25c41ff78d0a65029e410b5478430b1061df1dae;p=public-inbox.git diff --git a/lib/PublicInbox/Tmpfile.pm b/lib/PublicInbox/Tmpfile.pm index 28e87f88..3040dd77 100644 --- a/lib/PublicInbox/Tmpfile.pm +++ b/lib/PublicInbox/Tmpfile.pm @@ -1,18 +1,21 @@ -# Copyright (C) 2019 all contributors +# Copyright (C) 2019-2021 all contributors # License: AGPL-3.0+ package PublicInbox::Tmpfile; use strict; -use warnings; -use base qw(Exporter); +use v5.10.1; +use parent qw(Exporter); our @EXPORT = qw(tmpfile); use Fcntl qw(:DEFAULT); use Errno qw(EEXIST); -require File::Spec; +use File::Spec; # use tmpfile instead of open(..., '+>', undef) so we can get an # unlinked filename which makes sense when viewed with lsof # (at least on Linux) # And if we ever stop caring to have debuggable filenames, O_TMPFILE :) +# +# This is also for Perl <5.32 which lacks: open(..., '+>>', undef) +# sub tmpfile ($;$$) { my ($id, $sock, $append) = @_; if (defined $sock) {