Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 38075
Status: resolved
Worked: 3 min
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: brooks [...] deseret.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Provider.pm needs binmode()
Date: Thu, 31 Jul 2008 11:28:03 -0400
To: bug-Template-Toolkit [...] rt.cpan.org
From: Lyle Brooks <brooks [...] deseret.com>
While trying to port my TT2 work to a Windows environment I found that INSERT were mangling binary data. I believe the offending code is in Template/Provider.pm Here is the code snippet... 946 sub _template_content { 947 my ($self, $path) = @_; 948 949 return (undef, "No path specified to fetch content from ") 950 unless $path; 951 952 my $data; 953 my $mod_date; 954 my $error; 955 956 local *FH; 957 if (open(FH, "< $path")) { 958 local $/; 959 $data = <FH>; 960 $mod_date = (stat($path))[9]; 961 close(FH); 962 } 963 else { 964 $error = "$path: $!"; 965 } By inserting the line binmode(FH); right after the line with the open(), it seemed to correct the issue.
On Thu Jul 31 11:28:47 2008, brooks@deseret.com wrote: Show quoted text
> By inserting the line > > binmode(FH); > > right after the line with the open(), it seemed to correct the issue.
Applied, thanks again. A