about summary refs log tree commit homepage
path: root/lib/PublicInbox/Spamcheck/Spamc.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-11-26 08:52:50 +0000
committerEric Wong <e@80x24.org>2016-11-26 08:52:50 +0000
commitc008654229a9a693840ed30fadf6930bcd633b71 (patch)
treedffade86b539d195c04f312c8e3705251e0e0e42 /lib/PublicInbox/Spamcheck/Spamc.pm
parent57024ca2ae548a103dae12efaaf2f852d2c47e0e (diff)
downloadpublic-inbox-c008654229a9a693840ed30fadf6930bcd633b71.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/Spamcheck/Spamc.pm')
-rw-r--r--lib/PublicInbox/Spamcheck/Spamc.pm5
1 files changed, 2 insertions, 3 deletions
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: $!";