# functionality of nginx.
package PublicInbox::WwwStatic;
use strict;
+use v5.10.1;
use parent qw(Exporter);
-use bytes ();
use Fcntl qw(SEEK_SET O_RDONLY O_NONBLOCK);
use POSIX qw(strftime);
use HTTP::Date qw(time2str);
sub path_info_raw ($) {
my ($env) = @_;
my $sn = $env->{SCRIPT_NAME};
- my $re = $path_re_cache{$sn} ||= do {
+ my $re = $path_re_cache{$sn} //= do {
$sn = '/'.$sn unless index($sn, '/') == 0;
$sn =~ s!/\z!!;
qr!\A(?:https?://[^/]+)?\Q$sn\E(/[^\?\#]+)!;
"</head><body><pre>Index of $path_info_html</pre><hr><pre>\n");
$gzf->zmore(join("\n", @entries));
my $out = $gzf->zflush("</pre><hr></body></html>\n");
- $h->[3] = bytes::length($out);
+ $h->[3] = length($out);
[ 200, $h, [ $out ] ]
}