: | $FEATURES | ||
: | new(), init(), acquire(), attach(), detach(), release() |
package My::Facility; use base qw( Template::Facility ); package main; use Template; my $tt3 = Template->new({ FACILITIES => { myfacility => My::Facility->new(); } });
In version 3, all the core functional sub-systems of the runtime environment are separated out into separate facility modules. Different configurations and combinations of facilities can be defined for different runtime contexts. This architecture permits much greater flexibility in the degree to which the core Template Toolkit functionality can be customised to different environments or application areas.
Facilities are acquired for use by a
Template::Context object via the
acquire
($context) method and later
released via release()
. The former stores an
internal reference to the context for use by the facility methods,
the latter deletes it to explicity break any circular references.
Facilities can be acquired by a context on a per-request or
per-session basis.
Reference to a hash array defining features that the facility
implements. When the facility is bound to a context via the
acquire()
method, the attach()
is called to attach these features to the context. The
detach()
/release()
methods
reverse the process.
Not yet implemented.
new( \%vars )
Constructor method implemented by Template::Base.
init( \%config )
Initialiser method called by base class new() constructor method.
acquire(
Attaches the facility to a attach()
to populate the context with features.
attach()
Attaches facility features to the
detach()
Detaches facility features from the
release()
Calls the detach()
method to remove any facility features from
and then detaches self from the current