]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Spamcheck/Spamc.pm
spamcheck/spamc: fix compatibility with Perl 5.14.2
[public-inbox.git] / lib / PublicInbox / Spamcheck / Spamc.pm
index 312e52df92fd454274ed0fdf621b71a834b69dfa..5190c269285473a514a93b861e74302f3fc530d2 100644 (file)
@@ -75,8 +75,8 @@ sub _msg_to_fd {
        my $tmpfh;
        my $fd;
        if (my $ref = ref($msg)) {
-
-               return $msg->fileno if $ref ne 'SCALAR' && $msg->can('fileno');
+               my $fileno = eval { fileno($msg) };
+               return $fileno if defined $fileno;
 
                $tmpfh = IO::File->new_tmpfile;
                $tmpfh->autoflush(1);