]> Sergey Matveev's repositories - public-inbox.git/commitdiff
wwwstatic: use sprintf for Perl <5.22 compatibility
authorEric Wong <e@yhbt.net>
Mon, 6 Jan 2020 05:31:07 +0000 (05:31 +0000)
committerEric Wong <e@yhbt.net>
Mon, 6 Jan 2020 06:13:44 +0000 (06:13 +0000)
We only declare a Perl 5.10.1+ requirement, and POSIX::lround
was not added until 5.21.4 (5.22.0 for stable releases).

lib/PublicInbox/WwwStatic.pm

index bc42236e57b6e6442db9c7351e76587f68d3d871..917049bb68fde1d49c50d1a4056d5ad9d47aaa35 100644 (file)
@@ -12,7 +12,7 @@ use strict;
 use parent qw(Exporter);
 use bytes ();
 use Fcntl qw(SEEK_SET O_RDONLY O_NONBLOCK);
-use POSIX qw(strftime lround);
+use POSIX qw(strftime);
 use HTTP::Date qw(time2str);
 use HTTP::Status qw(status_message);
 use Errno qw(EACCES ENOTDIR ENOENT);
@@ -238,7 +238,7 @@ sub human_size ($) {
                        last;
                }
        }
-       lround($size).$suffix;
+       sprintf('%lu', $size).$suffix;
 }
 
 # by default, this returns "index.html" if it exists for a given directory