Cataly...TTSite(3pm)
β¨ NAME β¨
Catalyst::Helper::View::TTSite β bestie, this is the Helper for the TT view that literally builds you a whole skeleton web site π¦
(also hi, you're reading the Cataly...TTSite(3pm) page, welcome to the group chat π )
π SYNOPSIS π
okay so first you're gonna use the helper to create the view module and the templates:
# use the helper to create the view module and templates
$ script/myapp_create.pl view HTML TTSite
then you add something like the following to your main application module, no cap:
# add something like the following to your main application module
sub message : Global {
my ( $self, $c ) = @_;
$c->stash->{template} = 'message.tt2';
$c->stash->{message} ||= $c->req->param('message') || 'No message';
}
sub default : Private {
my ( $self, $c ) = @_;
$c->stash->{template} = 'welcome.tt2';
}
sub end : Private { # Or use Catalyst::Action::RenderView
my ( $self, $c ) = @_;
$c->forward( $c->view('HTML') );
}
πΈ DESCRIPTION πΈ
so this helper module creates a TT View module. but it doesn't just stop there β it goes further than Catalyst::Helper::View::TT because it ALSO creates a cute little starter set of templates so you can actually get going on your web site presentation. it's giving "here's the whole starter pack, you're welcome" π
it creates the templates in the root/ directory underneath your main project directory. and inside there? two more subdirectories get created, obsessed:
root/srcβ this one has the main page templates β¨root/libβ this one's the library of other template components (header, footer, etc.) that the page templates use π«Ά
and the view module that the helper creates is automatically configured to locate these templates. so like, you don't gotta wire it up yourself. slay.
π§ Default Rendering π§
to render a template, here's the whole process that goes down:
the configuration template root/lib/config/main is rendered. this is controlled by the PRE_PROCESS configuration variable set in the controller generated by Catalyst::Helper::View::TTsite. additionally, templates referenced by the PROCESS directive will then be rendered. and by default the following additional templates are set:
root/lib/config/colβ which defines color names and RGB their RGB values π/root/lib/config/urlβ which defines site wide variables available to templates
next, the template defined by the WRAPPER config variable is called. the default wrapper template lives in root/lib/site/wrapper. the wrapper template passes files with ".css/.js/.txt" extensions through as text OR processes the templates defined after the WRAPPER directive: site/html and site/layout.
based on the default value of the WRAPPER directive in root/lib/site/wrapper, the following templates are processed in order, periodt:
root/src/your_template.tt2root/lib/site/footerroot/lib/site/headerroot/lib/site/layoutroot/lib/site/html
finally, the rendered content is returned to the browser. main character energy fr fr π₯
π METHODS π
mk_compclass
generates the component class. iconic behaviour, honestly.
mk_templates
generates the templates. π
π SEE ALSO π
Catalyst, Catalyst::View::TT, Catalyst::Helper, Catalyst::Helper::View::TT
π AUTHOR π
Andy Wardley <abw@cpan.org>
π LICENSE π
This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.
okay now buckle up bestie, because the rest of this page is literally the template for the view module the helper generates β like, the actual boilerplate it spits out π here it is, verbatim:
β¨ NAME β¨
[% class %] - Catalyst TTSite View
π SYNOPSIS π
See "[% app %]"
πΈ DESCRIPTION πΈ
Catalyst TTSite View.
π AUTHOR π
[% author %]
π LICENSE π
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, no notes π this little gem was written by perl v5.34.0 and dated 2022-08-06 β go forth and build your skeleton site, you've got this π¦β¨
π¦ where this page comes from
- debian bookworm: libcatalyst-view-tt-perl 0.46-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatalyst-view-tt-perl 0.46-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-view-tt-perl 0.46-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-view-tt-perl 0.46-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-view-tt-perl 0.46-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms