[Templates-cvs] cvs commit: Template2/lib/Template Parser.pm Provider.pm

cvs@template-toolkit.org cvs@template-toolkit.org


cvs         06/08/01 17:35:43

  Modified:    lib/Template Parser.pm Provider.pm
  Log:
  * Fixed bug in Template::Parser to ensure $self->{ DEFBLOCKS } is cleared
    each time a parse() begins.
  * Fixed bug in Template::Provider to immediately invalidate the cache entry
    of any template that fails to compile.
  
  Revision  Changes    Path
  2.90      +2 -1      Template2/lib/Template/Parser.pm
  
  Index: Parser.pm
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Parser.pm,v
  retrieving revision 2.89
  retrieving revision 2.90
  diff -u -r2.89 -r2.90
  --- Parser.pm	2006/05/30 17:01:28	2.89
  +++ Parser.pm	2006/08/01 17:35:43	2.90
  @@ -30,7 +30,7 @@
   #      specified in the Perl README file.
   # 
   # REVISION
  -#   $Id: Parser.pm,v 2.89 2006/05/30 17:01:28 abw Exp $
  +#   $Id: Parser.pm,v 2.90 2006/08/01 17:35:43 abw Exp $
   #
   #============================================================================
   
  @@ -244,6 +244,7 @@
       # store for blocks defined in the template (see define_block())
       my $defblock = $self->{ DEFBLOCK } = { };
       my $metadata = $self->{ METADATA } = [ ];
  +    $self->{ DEFBLOCKS } = [ ];
   
       $self->{ _ERROR } = '';
   
  
  
  
  2.92      +10 -3     Template2/lib/Template/Provider.pm
  
  Index: Provider.pm
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Provider.pm,v
  retrieving revision 2.91
  retrieving revision 2.92
  diff -u -r2.91 -r2.92
  --- Provider.pm	2006/05/30 17:01:29	2.91
  +++ Provider.pm	2006/08/01 17:35:43	2.92
  @@ -26,7 +26,7 @@
   #   * fold ABSOLUTE and RELATIVE test cases into one regex?
   #
   # REVISION
  -#   $Id: Provider.pm,v 2.91 2006/05/30 17:01:29 abw Exp $
  +#   $Id: Provider.pm,v 2.92 2006/08/01 17:35:43 abw Exp $
   #
   #============================================================================
   
  @@ -718,8 +718,15 @@
                                              $slot->[ DATA ]->{ name });
               ($data, $error) = $self->_compile($data)
                   unless $error;
  -            
  -            unless ($error) {
  +                                           
  +            if ($error) {
  +                # if the template failed to load/compile then we wipe out the 
  +                # STAT entry.  This forces the provider to try and reload it
  +                # each time instead of using the previously cached version 
  +                # until $STAT_TTL is next up
  +                $slot->[ STAT ] = 0;
  +            }
  +            else {
                   $slot->[ DATA ] = $data->{ data };
                   $slot->[ LOAD ] = $data->{ time };
               }