Apache-Template
view release on metacpan or search on metacpan
lib/Apache/Template.pm view on Meta::CPAN
#========================================================================
# Configuration Handlers
#========================================================================
#------------------------------------------------------------------------
# TT2Tags html # specify TAG_STYLE
# TT2Tags [* *] # specify START_TAG and END_TAG
#------------------------------------------------------------------------
sub TT2Tags($$$$) {
my ($cfg, $parms, $start, $end) = @_;
if (defined $end and length $end) {
$cfg->{ START_TAG } = quotemeta($start);
$cfg->{ END_TAG } = quotemeta($end);
}
else {
$cfg->{ TAG_STYLE } = $start;
}
}
#------------------------------------------------------------------------
# TT2PreChomp On # enable PRE_CHOMP
#------------------------------------------------------------------------
sub TT2PreChomp($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ PRE_CHOMP } = $on;
}
#------------------------------------------------------------------------
# TT2PostChomp On # enable POST_CHOMP
#------------------------------------------------------------------------
sub TT2PostChomp($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ POST_CHOMP } = $on;
}
#------------------------------------------------------------------------
# TT2Trim On # enable TRIM
#------------------------------------------------------------------------
sub TT2Trim($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ TRIM } = $on;
}
#------------------------------------------------------------------------
# TT2AnyCase On # enable ANYCASE
#------------------------------------------------------------------------
sub TT2AnyCase($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ ANYCASE } = $on;
}
#------------------------------------------------------------------------
# TT2Interpolate On # enable INTERPOLATE
#------------------------------------------------------------------------
sub TT2Interpolate($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ INTERPOLATE } = $on;
}
#------------------------------------------------------------------------
# TT2Tolerant On # enable TOLERANT
#------------------------------------------------------------------------
sub TT2Tolerant($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ TOLERANT } = $on;
}
#------------------------------------------------------------------------
# TT2IncludePath /here /there # define INCLUDE_PATH directories
# TT2IncludePath /elsewhere # additional INCLUDE_PATH directories
#------------------------------------------------------------------------
sub TT2IncludePath($$@) {
my ($cfg, $parms, $path) = @_;
my $incpath = $cfg->{ INCLUDE_PATH } ||= [ ];
push(@$incpath, $path);
}
#------------------------------------------------------------------------
# TT2Absolute On # enable ABSOLUTE file paths
#------------------------------------------------------------------------
sub TT2Absolute($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ ABSOLUTE } = $on;
}
#------------------------------------------------------------------------
# TT2Relative On # enable RELATIVE file paths
#------------------------------------------------------------------------
sub TT2Relative($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ RELATIVE } = $on;
}
#------------------------------------------------------------------------
# TT2Delimiter , # set alternate directory delimiter
#------------------------------------------------------------------------
sub TT2Delimiter($$$) {
my ($cfg, $parms, $delim) = @_;
$cfg->{ DELIMITER } = $delim;
}
#------------------------------------------------------------------------
# TT2PreProcess config header # define PRE_PROCESS templates
# TT2PreProcess menu # additional PRE_PROCESS templates
#------------------------------------------------------------------------
sub TT2PreProcess($$@) {
my ($cfg, $parms, $file) = @_;
my $preproc = $cfg->{ PRE_PROCESS } ||= [ ];
push(@$preproc, $file);
}
#------------------------------------------------------------------------
# TT2Process main1 main2 # define PROCESS templates
# TT2Process main3 # additional PROCESS template
#------------------------------------------------------------------------
sub TT2Process($$@) {
my ($cfg, $parms, $file) = @_;
my $process = $cfg->{ PROCESS } ||= [ ];
push(@$process, $file);
}
#------------------------------------------------------------------------
# TT2Wrapper main1 main2 # define WRAPPER templates
# TT2Wrapper main3 # additional WRAPPER template
#------------------------------------------------------------------------
sub TT2Wrapper($$@) {
my ($cfg, $parms, $file) = @_;
my $wrapper = $cfg->{ WRAPPER } ||= [ ];
push(@$wrapper, $file);
}
#------------------------------------------------------------------------
# TT2PostProcess menu copyright # define POST_PROCESS templates
# TT2PostProcess footer # additional POST_PROCESS templates
#------------------------------------------------------------------------
sub TT2PostProcess($$@) {
my ($cfg, $parms, $file) = @_;
my $postproc = $cfg->{ POST_PROCESS } ||= [ ];
push(@$postproc, $file);
}
#------------------------------------------------------------------------
# TT2Default notfound # define DEFAULT template
#------------------------------------------------------------------------
sub TT2Default($$$) {
my ($cfg, $parms, $file) = @_;
$cfg->{ DEFAULT } = $file;
}
#------------------------------------------------------------------------
# TT2Error error # define ERROR template
#------------------------------------------------------------------------
sub TT2Error($$$) {
my ($cfg, $parms, $file) = @_;
$cfg->{ ERROR } = $file;
}
#------------------------------------------------------------------------
# TT2EvalPerl On # enable EVAL_PERL
#------------------------------------------------------------------------
sub TT2EvalPerl($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ EVAL_PERL } = $on;
}
#------------------------------------------------------------------------
# TT2LoadPerl On # enable LOAD_PERL
#------------------------------------------------------------------------
sub TT2LoadPerl($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ LOAD_PERL } = $on;
}
#------------------------------------------------------------------------
# TT2Recursion On # enable RECURSION
#------------------------------------------------------------------------
sub TT2Recursion($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ RECURSION } = $on;
}
#------------------------------------------------------------------------
# TT2PluginBase My::Plugins # define PLUGIN_BASE package(s)
# TT2PluginBase Your::Plugin # additional PLUGIN_BASE package(s)
#------------------------------------------------------------------------
sub TT2PluginBase($$@) {
my ($cfg, $parms, $base) = @_;
my $pbases = $cfg->{ PLUGIN_BASE } ||= [ ];
push(@$pbases, $base);
}
#------------------------------------------------------------------------
# TT2AutoReset Off # disable AUTO_RESET
#------------------------------------------------------------------------
sub TT2AutoReset($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ AUTO_RESET } = $on;
}
#------------------------------------------------------------------------
# TT2CacheSize 128 # define CACHE_SIZE
#------------------------------------------------------------------------
sub TT2CacheSize($$$) {
my ($cfg, $parms, $size) = @_;
$cfg->{ CACHE_SIZE } = $size;
}
#------------------------------------------------------------------------
# TT2CompileExt .tt2 # define COMPILE_EXT
#------------------------------------------------------------------------
sub TT2CompileExt($$$) {
my ($cfg, $parms, $ext) = @_;
$cfg->{ COMPILE_EXT } = $ext;
}
#------------------------------------------------------------------------
# TT2CompileDir /var/tt2/cache # define COMPILE_DIR
#------------------------------------------------------------------------
sub TT2CompileDir($$$) {
my ($cfg, $parms, $dir) = @_;
$cfg->{ COMPILE_DIR } = $dir;
}
#------------------------------------------------------------------------
# TT2Debug On # enable DEBUG
#------------------------------------------------------------------------
sub TT2Debug($$$) {
my ($cfg, $parms, $on) = @_;
$cfg->{ DEBUG } = $DEBUG = $on;
}
#------------------------------------------------------------------------
# TT2Headers length etag # add certain HTTP headers
#------------------------------------------------------------------------
sub TT2Headers($$@) {
my ($cfg, $parms, $item) = @_;
my $headers = $cfg->{ SERVICE_HEADERS } ||= [ ];
push(@$headers, $item);
}
#------------------------------------------------------------------------
# TT2Params uri env pnotes uploads request # add template vars
#------------------------------------------------------------------------
sub TT2Params($$@) {
my ($cfg, $parms, $item) = @_;
my $params = $cfg->{ SERVICE_PARAMS } ||= [ ];
push(@$params, $item);
}
#------------------------------------------------------------------------
# TT2ContentType text/xml # custom content type
#------------------------------------------------------------------------
sub TT2ContentType($$$) {
my ($cfg, $parms, $type) = @_;
$cfg->{ CONTENT_TYPE } = $type;
}
#------------------------------------------------------------------------
# TT2ServiceModule My::Service::Class # custom service module
#------------------------------------------------------------------------
sub TT2ServiceModule($$$) {
my ($cfg, $parms, $module) = @_;
$Template::Config::SERVICE = $module;
}
#------------------------------------------------------------------------
# TT2Variable name value # define template variable
#------------------------------------------------------------------------
sub TT2Variable($$$$) {
my ($cfg, $parms, $name, $value) = @_;
$cfg->{ VARIABLES }->{ $name } = $value;
}
#------------------------------------------------------------------------
# TT2Constant foo bar
#------------------------------------------------------------------------
sub TT2Constant($$@@) {
my ($cfg, $parms, $name, $value) = @_;
my $constants = $cfg->{ CONSTANTS } ||= { };
$constants->{ $name } = $value;
}
#------------------------------------------------------------------------
# TT2ConstantsNamespace const
#------------------------------------------------------------------------
sub TT2ConstantsNamespace($$$) {
my ($cfg, $parms, $namespace) = @_;
$cfg->{ CONSTANTS_NAMESPACE } = $namespace;
}
#========================================================================
# Configuration creators/mergers
#========================================================================
( run in 0.783 second using v1.01-cache-2.11-cpan-65fba6d93b7 )