Venus::Template

Template Class

Template Class for Perl 5

method: render

package main;

use Venus::Template;

my $template = Venus::Template->new(
  'From: <{{ email }}>',
);

# $template->render;

# "From: <>"

This package provides a templating system, and methods for rendering templates using simple markup and minimal control structures. The default opening and closing markers, denoting a template token, block, or control structure, are {{ and }}. A token takes the form of {{ foo }} or {{ foo.bar }}. A block takes the form of {{ for foo.bar }} where foo.bar represents any valid path, resolvable by "path" in Venus::Array or "path" in Venus::Hash, which returns an arrayref or Venus::Array object, and must be followed by {{ end foo }}. Control structures take the form of {{ if foo }} or {{ if not foo }}, may contain a nested {{ else foo }} control structure, and must be followed by {{ end foo }}. Leading and trailing whitespace is automatically removed from all replacements.

Venus::Kind::Utility

Venus::Role::Accessible Venus::Role::Buildable Venus::Role::Explainable Venus::Role::Valuable

variables: rw, opt, HashRef, {}

The render method processes the template by replacing the tokens and control structurs with the appropriate replacements and returns the result. Note: The rendering process expects variables to be hashrefs and sets (arrayrefs) of hashrefs.

render(Str $template, HashRef $variables) (Str)

{ since => '0.01', }

=example-1 render

# given: synopsis;

my $result = $template->render;

# "From: <>"

This package overloads the "" operator.

This package overloads the ~~ operator.

t/Venus.t: pdml: authors t/Venus.t: pdml: license

25 POD Errors

The following errors were encountered while parsing the POD:

Around line 13:

Unknown directive: =name

Around line 21:

Unknown directive: =tagline

Around line 29:

Unknown directive: =abstract

Around line 37:

Unknown directive: =includes

Around line 45:

Unknown directive: =synopsis

Around line 72:

Unknown directive: =description

Around line 90:

Unknown directive: =inherits

Around line 98:

Unknown directive: =integrates

Around line 109:

Unknown directive: =attributes

Around line 117:

Unknown directive: =method

Around line 124:

Unknown directive: =signature

Around line 128:

Unknown directive: =metadata

Around line 168:

=cut found outside a pod block. Skipping to next block.

Around line 195:

=cut found outside a pod block. Skipping to next block.

Around line 231:

=cut found outside a pod block. Skipping to next block.

Around line 276:

=cut found outside a pod block. Skipping to next block.

Around line 316:

=cut found outside a pod block. Skipping to next block.

Around line 356:

=cut found outside a pod block. Skipping to next block.

Around line 396:

=cut found outside a pod block. Skipping to next block.

Around line 410:

Unknown directive: =operator

Around line 426:

=cut found outside a pod block. Skipping to next block.

Around line 444:

=cut found outside a pod block. Skipping to next block.

Around line 454:

Unknown directive: =operator

Around line 470:

=cut found outside a pod block. Skipping to next block.

Around line 476:

Unknown directive: =partials