validator/httpd/cgi-bin check,1.715,1.716

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv14094/httpd/cgi-bin

Modified Files:
	check 
Log Message:
Add option to use file based template caching.  Doing it in non-mod_perl
environments results in a noticeable performance improvement.


Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.715
retrieving revision 1.716
diff -u -d -r1.715 -r1.716
--- check	23 Oct 2009 20:46:13 -0000	1.715
+++ check	24 Oct 2009 15:59:18 -0000	1.716
@@ -51,7 +51,7 @@
 use Encode::Alias              qw();
 use Encode::HanExtra           qw(); # for some chinese character encodings,
                                      # e.g gb18030
-use File::Spec::Functions      qw(catfile);
+use File::Spec::Functions      qw(catfile rel2abs tmpdir);
 use HTML::Encoding       0.52  qw();
 use HTML::Parser         3.24  qw(); # Need 3.24 for $p->parse($code_ref)
 use HTML::Template       2.6   qw(); # Need 2.6 for path param, other things.
@@ -119,7 +119,8 @@
        -DefaultConfig    => {
           Protocols => {Allow => 'http,https'},
           Paths => {
-            Base => ($ENV{W3C_VALIDATOR_HOME} || '/usr/local/validator'),
+            Base  => ($ENV{W3C_VALIDATOR_HOME} || '/usr/local/validator'),
+            Cache => '',
           },
           External => {
             HTML5 => FALSE,
@@ -322,12 +323,19 @@
 
 $File->{Template_Defaults} = {
   die_on_bad_params => FALSE,
-  cache             => TRUE,
   loop_context_vars => TRUE,
   global_vars       => TRUE,
   path              => [ catfile($CFG->{Paths}->{Templates}, $lang) ],
   filter => sub { my $ref = shift; ${$ref} = Encode::decode_utf8(${$ref}); },
 };
+if (IS_MODPERL2()) {
+  $File->{Template_Defaults}->{cache} = TRUE;
+}
+elsif ($CFG->{Paths}->{Cache}) {
+  $File->{Template_Defaults}->{file_cache} = TRUE;
+  $File->{Template_Defaults}->{file_cache_dir} =
+    rel2abs($CFG->{Paths}->{Cache}, tmpdir());
+}
 
 undef $lang;
 

Received on Saturday, 24 October 2009 15:59:22 UTC