The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MojoX::Renderer::CTPP2 - CTPP2 renderer for Mojo

SYNOPSIS

Add the handler:

    use MojoX::Renderer::CTPP2;

    sub startup {
       ...

       my $ctpp2 = MojoX::Renderer::CTPP2->build(
            mojo        => $self,
            COMPILE_DIR => '/tmp/ctpp',
            COMPILE_EXT => '.ctpp2'
            template_options =>
             { arg_stack_size => 1024,
               arg_stack_size => 2048
             }
       );

       $self->renderer->add_handler( ctpp2 => $ctpp2 );

       ...
    }

And then in the handler call render which will call the MojoX::Renderer::CTPP2 renderer.

   $c->render(foo => 653, bar => [qw(abc 7583 def)]);

METHODS

build

This method returns a handler for the Mojo renderer.

Supported parameters are:

mojo

new currently requires a mojo parameter pointing to the base class Mojo-object. (Need for initial path to compiled templates.)

COMPILE_DIR

Root of directory in which compiled template files should be written.

If not defined 'COMPILE_DIR' or 'COMPILE_EXT' params - template don't compile and save.

COMPILE_EXT

Filename extension for compiled template files (default - .ctpp2c).

template_options

A hash reference of options that are passed to CTPP2->new().

About path for compiled templates:

  • If mojo and COMPILE_DIR are defined:

    • COMPILE_DIR is absolute path - use this absolute path (ex.: mojo project root path - '/mojo', COMPILE_DIR - '/c_tmpl', path for compiled templates - '/c_tmpl')

    • COMPILE_DIR is relative path - use relative path into mojo root directory (ex.: mojo project root path - '/mojo', COMPILE_DIR - 'tmp/c_tmpl', path for compiled templates - '/mojo/tmp/c_tmpl')

  • If mojo defined and COMPILE_DIR not defined:

    • use relative path 'tmp/ctpp2' into mojo root directory (ex.: mojo project root path - '/mojo', path for compiled templates - '/mojo/tmp/ctpp2')

  • If mojo not defined and COMPILE_DIR are defined:

    • COMPILE_DIR is absolute path - use this absolute path (COMPILE_DIR - '/c_tmpl', path for compiled templates - '/c_tmpl')

    • COMPILE_DIR is relative path - use relative path into File::Spec->tmpdir function directory (ex.: system temporary path - '/tmp', COMPILE_DIR - 'c_tmpl', path for compiled templates - '/tmp/c_tmpl')

  • Both parameters mojo and COMPILE_DIR not defined:

    • use relative path 'ctpp2' into File::Spec->tmpdir function directory (ex.: system temporary path - '/tmp', path for compiled templates - '/tmp/ctpp2')

AUTHOR

Victor M Elfimov, (victor@sols.ru)

BUGS

Please report any bugs or feature requests to bug-mojox-renderer-ctpp2 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MojoX-Renderer-CTPP2. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc MojoX::Renderer::CTPP2

You can also look for information at:

SEE ALSO

HTML::CTPP2(3)

COPYRIGHT & LICENSE

Copyright 2009 Victor M Elfimov

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.