From c008654229a9a693840ed30fadf6930bcd633b71 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 26 Nov 2016 08:52:50 +0000 Subject: avoid IO::File for anonymous temporary files We do not need to import IO::File into the main programs since Perl 5.8+ supports literal "undef" for generating anonymous temporary file handles. --- lib/PublicInbox/Spamcheck/Spamc.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/Spamcheck') diff --git a/lib/PublicInbox/Spamcheck/Spamc.pm b/lib/PublicInbox/Spamcheck/Spamc.pm index 5190c269..30eec95c 100644 --- a/lib/PublicInbox/Spamcheck/Spamc.pm +++ b/lib/PublicInbox/Spamcheck/Spamc.pm @@ -4,7 +4,7 @@ package PublicInbox::Spamcheck::Spamc; 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 { @@ -72,13 +72,12 @@ sub _devnull { 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: $!"; -- cgit v1.2.3-24-ge0c7