NAME
Langertha::Holmgang::Template - Kolon output templates of handlers and observations
VERSION
version 0.001
SYNOPSIS
use Langertha::Holmgang::Template qw( render );
my $text = render( "<: $state.lampe.an :>\n", $state, \%args );
my $text = render( $template, $state, \%args, $simulators ); # nft_verdict through this registry
DESCRIPTION
The output of a handler or an observation is a Kolon template (Text::Xslate, type text, so nothing is HTML-escaped), rendered with two variables, $state (the whole state, after the handler's change) and $args (the call's arguments plus the named captures of match), and these functions:
re($text, $pattern)-
1when the text matches the Perl regular expression, else0. cap($text, $pattern)-
The first capture group of the match, or
''. has($list, $value)-
1when the list holds the value (numbers numerically, text exactly). pad($text, $width)-
The text left-aligned and padded with blanks to
$width. nft_verdict($device, \%packet)-
acceptordrop: what the packet filter of the device does with the packet, asked through the simulator registry ("packet_verdict" in Langertha::Holmgang::Simulators);''when the device's simulator cannot answer or a rule on the way cannot be evaluated.
A text without Kolon markers (<: or a line starting with :) comes back as it is; no template at all renders as ok.
A plain function module: the Linux simulator renders the start messages of its services through "render" too.
render
my $text = render( $template, $state, \%args, $simulators );
Renders the template with $state and $args (default {}). $simulators is the registry nft_verdict asks; without it a fresh Langertha::Holmgang::Simulators. Dies when the template does not compile.
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/langertha-holmgang/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.