Skip Menu |

This queue is for tickets about the Net-BitTorrent-File CPAN distribution.

Report information
The Basics
Id: 9419
Status: resolved
Priority: 0/
Queue: Net-BitTorrent-File

People
Owner: Nobody in particular
Requestors: jhitt25 [...] swbell.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.01-fix
Fixed in: (no value)



Subject: Bug in load() function - $/ usage incorrect
Currently: $/ = ''; Proposed: local $/; Reason: Setting $/ to '' indicates that we should treat consecutive empty lines as a single newline. What is desired here is to "slurp" the entire file in, which is what the proposed solution does.
From: josh mcadams
[guest - Wed Jan 5 01:10:57 2005]: Show quoted text
> Currently: $/ = ''; > Proposed: local $/; > Reason: Setting $/ to '' indicates that we should treat consecutive > empty lines as a single newline. What is desired here is to > "slurp" the entire file in, which is what the proposed solution > does.
This is causing some problems with some pretty common .torrent files. Attached is a patch if you want to apply it.
--- File.pm 2005-07-20 21:39:33.000000000 -0500 +++ /usr/lib/perl5/site_perl/5.8.5/Net/BitTorrent/File.pm 2005-07-20 21:43:43.000000000 -0500 @@ -297,8 +297,10 @@ my $buff = ''; open(FILE, '< '.$file); - $/ = ''; - $buff = <FILE>; + { + local $/; + $buff = <FILE>; + } close(FILE); my $root = bdecode($buff); $self->{'data'} = $root;