diff options
Diffstat (limited to 'Master/tlpkg/tlperl/site/lib/LWP/Protocol/file.pm')
-rw-r--r-- | Master/tlpkg/tlperl/site/lib/LWP/Protocol/file.pm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Master/tlpkg/tlperl/site/lib/LWP/Protocol/file.pm b/Master/tlpkg/tlperl/site/lib/LWP/Protocol/file.pm index e83149dbd90..2db309af894 100644 --- a/Master/tlpkg/tlperl/site/lib/LWP/Protocol/file.pm +++ b/Master/tlpkg/tlperl/site/lib/LWP/Protocol/file.pm @@ -1,9 +1,11 @@ package LWP::Protocol::file; -$LWP::Protocol::file::VERSION = '6.25'; + use base qw(LWP::Protocol); use strict; +our $VERSION = '6.31'; + require LWP::MediaTypes; require HTTP::Request; require HTTP::Response; @@ -126,17 +128,17 @@ sub request # read the file if ($method ne "HEAD") { - open(F, $path) or return new + open(my $fh, '<', $path) or return new HTTP::Response(HTTP::Status::RC_INTERNAL_SERVER_ERROR, "Cannot read file '$path': $!"); - binmode(F); + binmode($fh); $response = $self->collect($arg, $response, sub { my $content = ""; - my $bytes = sysread(F, $content, $size); + my $bytes = sysread($fh, $content, $size); return \$content if $bytes > 0; return \ ""; }); - close(F); + close($fh); } $response; |