Mail Index


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ApacheGallery] patch to do proper Text::Template error reporting



On Mon, 08 Nov 2004, Tom Brown wrote:
> Error message: 
> Unable to create new Text::Template object for directory: Couldn't
> open file /home/tdbrown/code/apache-gallery/template/directory.tpl:
> Permission denied at /usr/share/perl5/Apache/Gallery.pm line 1438. 
> 
> This is not a big deal to me. Just letting you know.

Heh. Yeah, wasn't thinking much about leakage in the ERROR...

I'm not sure what the best way to deal with this if we actually want
to hide the path... because most people who will see this error will
only see it during set up, and they probably won't check apache's
error log instantly.

Anyway, the easy way to fix it is to do something like the following:

for my $template_name (keys %$templates) {
     my $tt_obj = Text::Template->new(TYPE   => 'FILE',
				      SOURCE => $$templates{$template_name},
				      BROKEN => \&tt_broken,
				      BROKEN_ARG => [$template_name, $$templates{$template_name}],
				     );
     if (not defined $tt_obj) {
	print STDERR "Unable to create new Text::Template object for $template_name: $Text::Template::ERROR\n";
	die "Unable to create new Text::Template object for $template_name";
     }
     $texttemplate_objects{$template_name} = $tt_obj;
}

But I'm not sure if that's desirable or not. *shrug* 

My main motivation for hiding the filename in the template errors was
that it's possible that the site would work just fine with those
errors occuring, and a casual admin would miss them.


Don Armstrong

-- 
There are two types of people in this world, good and bad. The good
sleep better, but the bad seem to enjoy the waking hours much more.  
 -- Woody Allen

http://www.donarmstrong.com              http://rzlab.ucr.edu
_______________________________________________
users mailing list
users@xxxxxxxxxxxxxxxx
http://ufo.hestdesign.com/cgi-bin/mailman/listinfo/agusers