package Simple; use strict; use lib '/var/www/mod_perl/build/TT2_wip/lib'; use CGI::Builder qw/ CGI::Builder::TT2 /; use Data::Dumper; sub PH_index { my ($self) = @_; # # Use your PH handler to calculate values and store them for use # by your templates. # $self->tt_vars(page_title => "Simple Example"); $self->tt_vars(content => $self->myContent); # # If you wish, you can set a custom template in your PH handler, # instead of using the default. # # $self->tt_template('my_special_template.tt2'); # # If you have templates stored in other places, you may want to # change your include path. # # $self->tt_new_args(INCLUDE_PATH => ['/my/app/templates', '/usr/local/tt2']); # # If, for some reason, you want to disable the template engine for # this request, just set the page content to something else. # # $self->page_content("Not a Template!"); }#END sub PH_index sub myContent { my ($self, $content) = @_; $content .= sprintf("\n
Page Name defaults to (%s)
", $self->page_name); $content .= sprintf("\nPage Suffix defaults to (%s)
", $self->page_suffix); $content .= sprintf("\nTemplate defaults to page_name + page_suffix (%s)
", $self->tt_template); $content .= sprintf("\nPage Path defaults to (%s)
", $self->page_path); my $d = Data::Dumper->new( [scalar($self->tt_new_args)], ['tt_new_args'] ); $content .= sprintf("\nTemplate new args by default will contain only one
value, it will set the INCLUDE_PATH = page_path. You may override this
if your templates are in a different place (or in multiple places).
%s