CGI-AppToolkit
view release on metacpan or search on metacpan
lib/CGI/AppToolkit/Template.pm view on Meta::CPAN
767778798081828384858687888990919293949596sub
load {
my
$self
=
shift
;
my
$template_file_orig
=
shift
;
if
(!
$self
->{
'cache'
}
||
(!
$CACHE
{
$template_file_orig
})
||
((
stat
(_))[9] !=
$CACHE
{
$template_file_orig
}[0])) {
my
$template_file
=
''
;
if
(
$template_file_orig
!~ m{/}) {
foreach
my
$dir
(
@PATH
) {
if
(-d
$dir
&& (-e
"$dir/$template_file_orig"
|| -e
"$dir/$template_file_orig.tmpl"
)) {
$template_file
= -e
"$dir/$template_file_orig"
?
"$dir/$template_file_orig"
:
"$dir/$template_file_orig.tmpl"
;
last
;
}
}
lib/CGI/AppToolkit/Template.pm view on Meta::CPAN
106107108109110111112113114115116117118119120121122123124125126
local
$/ =
undef
;
my
$template
= _cleanup(<FORM>);
close
FORM;
$self
->{
'template'
} = CGI::AppToolkit::Template::TemplateC->new(
$template
);
$self
->_load_vars
unless
$self
->{
'vars-loaded'
};
# MAKE PATH FULL HERE
$CACHE
{
$template_file
} = [
(
stat
(_))[9],
$self
->{
'template'
},
$self
->{
'vars'
}
]
if
$self
->{
'cache'
};
}
else
{
(
$self
->{
'template'
},
$self
->{
'vars'
}) = @{
$CACHE
{
$template_file_orig
}}[1, 2];
}
}
lib/CGI/AppToolkit/Template.pm view on Meta::CPAN
162163164165166167168169170171172173174175176177178179180181182
$t
=~ s/^(.*?)<\s
*repeattoken
\s*(?:name\s*=\s*(['
"])([-_a-zA-Z0-9]+)\2?|name\s*=\s*([-_a-zA-Z0-9]+)|([-_a-zA-Z0-9]+))\s*([^>]*)\/>(.*(?:\n|\z))/<repeattoken name="
$3$4$5"$6>$1$7<\/repeattoken>/mg;
$t
}
#-------------------------
sub
check_cache {
my
(
$self
) =
shift
;
if
((
$self
->{
'file-name'
}) && ((
stat
(
$self
->{
'file-name'
}))[9] !=
$self
->{
'file-date'
})) {
$self
->load(
$self
->{
'file-name'
});
return
1;
}
0
}
#-------------------------
sub
make {
( run in 0.451 second using v1.01-cache-2.11-cpan-c6e0e5ac2a7 )