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.