[Catalyst] Setting Template Tookit WHILE_MAX from Catalyst

Tomas Doran bobtfish at bobtfish.net
Mon Jan 26 22:56:44 GMT 2009


On 26 Jan 2009, at 19:50, Kutbuddin wrote:

>
> Hi,
>
> I would like to know how to set the TT variable :
> $Template::Directive::WHILE_MAX
>
> from within Catalyst.. maybe as part of the site View configuration in
> lib/MyApp/View/TT.pm
> or similar
>
> By default the maximum for a while loop is 1000.

This isn't actually a config setting - you have to override the  
global variable.

The correct way to do this is in MyApp::View::TT:

use MRO::Compat;

sub process {
     my $self = shift;
     local $Template::Directive::WHILE_MAX = 10000; # Or whatever you  
want
     $self->next::method(@_);
}

Cheers
t0m




More information about the Catalyst mailing list