CGI-AppToolkit

 view release on metacpan or  search on metacpan

lib/CGI/AppToolkit/Template.pm  view on Meta::CPAN

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
 
sub 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

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
                        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

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
        $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 )