Skip Menu |

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

Report information
The Basics
Id: 5327
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: slaven [...] rezic.de
Cc:
AdminCc:

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



Subject: Misleading error message
Try this minimal script using Template-Toolkit: use Template; my $t = Template->new; $t->process("foo", {}) or die $t->error; __END__ and create a file "foo" and remove all permissions from it: chmod 000 foo and finally call the script. The error message is: Can't use string ("foo: Permission denied") as a HASH ref while "strict refs" in use at /usr/perl5.8.0/lib/site_perl/5.8.0/i386-freebsd-64int/Template/Provider.pm line 663. Moreover, if the template file name is longer, the "Permission denied" bit is snipped, causing even more confusion.
From: srezic [...] cpan.org
[SREZIC - Fri Feb 13 17:38:44 2004]: Show quoted text
> Try this minimal script using Template-Toolkit: > > use Template; > my $t = Template->new; > $t->process("foo", {}) or die $t->error; > __END__ > > and create a file "foo" and remove all permissions from it: > > chmod 000 foo > > and finally call the script. The error message is: > > Can't use string ("foo: Permission denied") as a HASH ref while > "strict refs" in use at /usr/perl5.8.0/lib/site_perl/5.8.0/i386- > freebsd-64int/Template/Provider.pm line 663. > > Moreover, if the template file name is longer, the "Permission denied" > bit > is snipped, causing even more confusion.
The issue is still there with the 2.14 release of Template-Toolkit. Just one correction: the file has to exist but be not readable: use Template; system("touch /tmp/foo; chmod 0 /tmp/foo"); my $t = Template->new(ABSOLUTE => 1); $t->process("/tmp/foo", {}) or die $t->error; __END__ Here's also a patch againt the 2.14 release: --- Provider.pm.orig 2005-01-10 10:26:32.000000000 +0100 +++ Provider.pm 2005-01-10 10:26:49.000000000 +0100 @@ -687,7 +687,7 @@ } $data->{ path } = $data->{ name } - if $data and ! defined $data->{ path }; + if $data and ref $data and ! defined $data->{ path }; return ($data, $error); } Regards, Slaven