Apache-Template

 view release on metacpan or  search on metacpan

lib/Apache/Template.pm  view on Meta::CPAN

1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
custom service module.  The following trivial example shows how you
might subclass Template::Service::Apache to add an additional parameter,
in this case as the template variable 'message'.
 
    <perl>
    package My::Service::Module;
    use base qw( https://metacpan.org/pod/Template::Service::Apache">Template::Service::Apache );
 
    sub params {
    my $self = shift;
        my $params = $self->SUPER::params(@_);
        $params->{ message } = 'Hello World';
        return $params;
    }
    </perl>
 
    PerlModule          Apache::Template
    TT2ServiceModule    My::Service::Module
 
=back

lib/Template/Service/Apache.pm  view on Meta::CPAN

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
my $rootcfg = {
    ABSOLUTE => 1,
    map { exists $config->{ $_ } ? ($_, $config->{ $_ }) : () }
    qw( COMPILE_DIR COMPILE_EXT CACHE_SIZE PARSER ),
};
 
my $rootprov = Template::Config->provider($rootcfg)
    || return $self->error(Template::Config->error());
 
# now let the Template::Service superclass initialiser continue
$self->SUPER::_init($config)
    || return undef;
 
# save reference to root document provider
$self->{ ROOT_PROVIDER } = $rootprov;
 
# determine content type or use default
$self->{ CONTENT_TYPE } = $config->{ CONTENT_TYPE } || $CONTENT_TYPE;
 
 
# if TT2Headers not explicitly defined then we default it to



( run in 0.295 second using v1.01-cache-2.11-cpan-454fe037f31 )