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

Zbigniew Lukasiak zzbbyy at gmail.com
Wed Jan 11 14:54:02 CET 2006

> 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/ );
Unfortunately this will not work - the $self->include_path is a
reference to the array that is used by the template engine if you
change it it will be a reference to your array but no longer to the
array used by the template engine.   I hope someone will find more
clear description of the problem that will go to the documents :) 
Basicly you should only use that method for reading to get the
referrence and than use it to change the array like:
$path_array = $self->include_path( );
@$path_array = ( qw/path another_path/ );

I think we should make the setter a private method and only expose the
reader, then document how it works with examples.

-- Zbyszek

More information about the Catalyst mailing list