The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

NAME

Terse::View::TT - Terse Template Toolkit View

VERSION

Version 0.03

SYNOPSIS

lib/Karaoke/View/TT.pm

lib/Karaoke/Controller/Songs.pm

sub songs : any : view(tt) {
my ($self, $t) = @_;
$t->response->popular_songs = $t->model('Songs')->popular_songs(5);
...
}
sub add : get : path(songs/add) : view(tt) { ... }
sub add : post : path(songs/add) { ... }
...
1;

root/src/wrapper.tt

<html>
<head>
...
</head>
<body>
...
[% content %]
...
</body>
</html>

root/src/songs.tt

<div>
...
<h1>Top 5 Songs</h1>
[% FOREACH song in popular_songs %]
<div>
...
</div>
[% END %]
...
</div>

Karaoke.psgi

use lib 'lib';
use Terse;
use Karaoke;
our $app = Karaoke->start(
lib => 'lib',
views => {
TT => {
WRAPPER => 'wrapper'
}
}
);
sub {
my ($env) = (shift);
Terse->run(
plack_env => $env,
application => $app,
);
};

...

plackup -s Starman Karaoke.psgi

...

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-terse-view-tt at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Terse-View-TT. 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 Terse::View::TT

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2023 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)