]> Sergey Matveev's repositories - public-inbox.git/commitdiff
tmpfile: modernize to 5.10.1+, note O_APPEND workaround
authorEric Wong <e@80x24.org>
Fri, 16 Oct 2020 07:05:10 +0000 (07:05 +0000)
committerEric Wong <e@80x24.org>
Fri, 16 Oct 2020 17:15:32 +0000 (17:15 +0000)
Once again we'll need O_APPEND on a temporary file, so note we
support it, here; since Perl 5.32 is way too new to depend on
our users having.

lib/PublicInbox/Tmpfile.pm

index 25bb3a52720e42748ad6d8642102439a1382b51e..eb0fce0036be0c168f5f94212589661508c3e1b8 100644 (file)
@@ -2,8 +2,8 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 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);
@@ -13,6 +13,9 @@ use File::Spec;
 # 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)
+# <https://rt.perl.org/Ticket/Display.html?id=134221>
 sub tmpfile ($;$$) {
        my ($id, $sock, $append) = @_;
        if (defined $sock) {