FAQ
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.

thanks..
--
View this message in context: http://www.nabble.com/Setting-Template-Tookit-WHILE_MAX-from-Catalyst-tp21672356p21672356.html
Sent from the Catalyst Web Framework mailing list archive at Nabble.com.

Search Discussions

  • Matt Pitts at Jan 26, 2009 at 8:47 pm

    -----Original Message-----
    From: Kutbuddin
    Sent: Monday, January 26, 2009 2:50 PM
    To: catalyst@lists.scsys.co.uk
    Subject: [Catalyst] Setting Template Tookit WHILE_MAX from Catalyst


    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
    Haven't done it myself, but if there's not a documented config option or
    method for setting it, then I would just set it directly in your
    View/TT.pm as you've suggested.

    v/r
    -matt pitts
  • Kutbuddin at Jan 26, 2009 at 9:57 pm
    OK.. so how?
    I tried :
    __PACKAGE__->config({
    CATALYST_VAR => 'Catalyst',
    INCLUDE_PATH => [
    subs->path_to( 'root', 'src' ),
    subs->path_to( 'root', 'lib' )
    ],
    PRE_PROCESS => 'config/main',
    WRAPPER => 'site/wrapper',
    ERROR => 'error.tt2',
    TIMER => 0,
    WHILE_MAX => 100,
    });


    and also
    'Directive::WHILE_MAX' => 100, (substitute for line above)

    both had no effect!

    The Catalyst::View::TT perldoc says to set config options in lib/MyApp.pm,
    however, these are in lib/MyApp/View/TT.pm but seems to be doing the same
    thing.

    The config passing code is little difficult to follow, so perhaps an expert
    tell me what I am getting wrong..

    thanks,
    -Kutbuddin



    Matt Pitts wrote:
    -----Original Message-----
    From: Kutbuddin
    Sent: Monday, January 26, 2009 2:50 PM
    To: catalyst@lists.scsys.co.uk
    Subject: [Catalyst] Setting Template Tookit WHILE_MAX from Catalyst


    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
    Haven't done it myself, but if there's not a documented config option or
    method for setting it, then I would just set it directly in your
    View/TT.pm as you've suggested.

    v/r
    -matt pitts

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    --
    View this message in context: http://www.nabble.com/Setting-Template-Tookit-WHILE_MAX-from-Catalyst-tp21672356p21673995.html
    Sent from the Catalyst Web Framework mailing list archive at Nabble.com.
  • Jay Shirley at Jan 26, 2009 at 10:54 pm

    On Mon, Jan 26, 2009 at 1:57 PM, Kutbuddin wrote:

    OK.. so how?
    I tried :
    __PACKAGE__->config({
    CATALYST_VAR => 'Catalyst',
    INCLUDE_PATH => [
    subs->path_to( 'root', 'src' ),
    subs->path_to( 'root', 'lib' )
    ],
    PRE_PROCESS => 'config/main',
    WRAPPER => 'site/wrapper',
    ERROR => 'error.tt2',
    TIMER => 0,
    WHILE_MAX => 100,
    });


    and also
    'Directive::WHILE_MAX' => 100, (substitute for line above)

    both had no effect!

    The Catalyst::View::TT perldoc says to set config options in lib/MyApp.pm,
    however, these are in lib/MyApp/View/TT.pm but seems to be doing the same
    thing.

    The config passing code is little difficult to follow, so perhaps an expert
    tell me what I am getting wrong..

    thanks,
    -Kutbuddin

    This is not a configuration option, it is a perl variable. You set it
    like any other perl variable:

    package MyApp::View::TT;

    use Template;

    $Template::Directive::WHILE_MAX = 100;

    ... rest of your code ...

    1;

    This is just perl, nothing else. No magic.

    -J
  • Jay Shirley at Jan 26, 2009 at 9:43 pm

    On Mon, Jan 26, 2009 at 11:50 AM, 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.

    thanks..
    --
    View this message in context: http://www.nabble.com/Setting-Template-Tookit-WHILE_MAX-from-Catalyst-tp21672356p21672356.html
    Sent from the Catalyst Web Framework mailing list archive at Nabble.com.

    1) Edit lib/MyApp/View/TT.pm
    2) Add: $Template::Directive::WHILE_MAX = $desired_value;
    3) Profit.

    -J
  • Kutbuddin at Jan 27, 2009 at 1:12 am
    Ca-ching!
    Thanks J - I surely profited from that advice. It works.


    J. Shirley wrote:
    On Mon, Jan 26, 2009 at 11:50 AM, 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.

    thanks..
    --
    View this message in context:
    http://www.nabble.com/Setting-Template-Tookit-WHILE_MAX-from-Catalyst-tp21672356p21672356.html
    Sent from the Catalyst Web Framework mailing list archive at Nabble.com.

    1) Edit lib/MyApp/View/TT.pm
    2) Add: $Template::Directive::WHILE_MAX = $desired_value;
    3) Profit.

    -J

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    --
    View this message in context: http://www.nabble.com/Setting-Template-Tookit-WHILE_MAX-from-Catalyst-tp21672356p21677025.html
    Sent from the Catalyst Web Framework mailing list archive at Nabble.com.
  • Tomas Doran at Jan 26, 2009 at 10:56 pm

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJan 26, '09 at 7:50p
activeJan 27, '09 at 1:12a
posts7
users4
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase