[Catalyst] additional_template_paths in Catalyst::View::TT 0.21

Will Hawes info at whawes.co.uk
Wed Jan 11 14:02:24 CET 2006

Chisel Wright wrote:
> On Wed, Jan 11, 2006 at 09:57:43AM +0100, Zbigniew Lukasiak wrote:
>> 1. The additional paths are added at the beginning of the INCLUDE_PATH
>> not at the end. This needs to be fixed in the POD.
>> 2. There is an accessor to the reference to the INCLUDE_PATH array -
>> include_path.  This perhaps needs to be added to the POD as well.  If
>> you use it you take full responsibility over it and you need to
>> remember that the template provider is being used between requests and
>> subrequests and if you just add to it without cleaning this can be a
>> memory leak.
> Are there examples anywhere to show How To Do It Properly.
> This is something I'd like to look at in the next week or few, and "if
> you just add to it without cleaning" is a warning that I need to do
> *something*, but I've no idea what/when/where.

"Cleaning" in this case probably refers to checking for duplication. I 
think I'm right in saying that if you are in a persistent environment 
e.g. mod_perl and you do

push( @{$self->include_path}, 'foo');

you will add 'foo' to INCLUDE_PATH every time the code runs. Voila, 
memory leak.

AFAIK provided you use include_path() to overwrite INCLUDE_PATH in its 
entirety rather than modifying it you should be OK:

$self->include_path( qw/path another_path/ );

More information about the Catalyst mailing list