1Template::Namespace::CoUnssetranCtosn(t3r)ibuted Perl DoTceummpelnattaet:i:oNnamespace::Constants(3)
2
3
4

NAME

6       Template::Namespace::Constants - Compile time constant folding
7

SYNOPSIS

9           # easy way to define constants
10           use Template;
11
12           my $tt = Template->new({
13               CONSTANTS => {
14                   pi => 3.14,
15                   e  => 2.718,
16               },
17           });
18
19           # nitty-gritty, hands-dirty way
20           use Template::Namespace::Constants;
21
22           my $tt = Template->new({
23               NAMESPACE => {
24                   constants => Template::Namespace::Constants->new({
25                       pi => 3.14,
26                       e  => 2.718,
27                   },
28               },
29           });
30

DESCRIPTION

32       The Template::Namespace::Constants module implements a namespace han‐
33       dler which is plugged into the Template::Directive compiler module.
34       This then performs compile time constant folding of variables in a par‐
35       ticular namespace.
36

PUBLIC METHODS

38       new(\%constants)
39
40       The new() constructor method creates and returns a reference to a new
41       Template::Namespace::Constants object.  This creates an internal stash
42       to store the constant variable definitions passed as arguments.
43
44           my $handler = Template::Namespace::Constants->new({
45               pi => 3.14,
46               e  => 2.718,
47           });
48
49       ident(\@ident)
50
51       Method called to resolve a variable identifier into a compiled form.
52       In this case, the method fetches the corresponding constant value from
53       its internal stash and returns it.
54

AUTHOR

56       Andy Wardley <abw@wardley.org>
57
58       <http://wardley.org/http://wardley.org/>
59

VERSION

61       1.27, distributed as part of the Template Toolkit version 2.18,
62       released on 09 February 2007.
63
65         Copyright (C) 1996-2007 Andy Wardley.  All Rights Reserved.
66
67       This module is free software; you can redistribute it and/or modify it
68       under the same terms as Perl itself.
69

SEE ALSO

71       Template::Directive
72
73
74
75perl v5.8.8                       2007-02-09 Template::Namespace::Constants(3)
Impressum