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

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


cvs         06/02/02 13:12:52

  Modified:    lib/Template Provider.pm
  Log:
  * added patch from Jess Robinson to move file freshness check into
    separate _mtime() method to play nicely with his DBI provider
  
  Revision  Changes    Path
  2.88      +16 -9     Template2/lib/Template/Provider.pm
  
  Index: Provider.pm
  ===================================================================
  RCS file: /template-toolkit/Template2/lib/Template/Provider.pm,v
  retrieving revision 2.87
  retrieving revision 2.88
  diff -u -r2.87 -r2.88
  --- Provider.pm	2006/02/01 08:36:09	2.87
  +++ Provider.pm	2006/02/02 13:12:52	2.88
  @@ -27,7 +27,7 @@
   #
   #----------------------------------------------------------------------------
   #
  -# $Id: Provider.pm,v 2.87 2006/02/01 08:36:09 abw Exp $
  +# $Id: Provider.pm,v 2.88 2006/02/02 13:12:52 abw Exp $
   #
   #============================================================================
   
  @@ -49,7 +49,7 @@
   use constant NEXT   => 4;
   use constant STAT   => 5;
   
  -our $VERSION = sprintf("%d.%02d", q$Revision: 2.87 $ =~ /(\d+)\.(\d+)/);
  +our $VERSION = sprintf("%d.%02d", q$Revision: 2.88 $ =~ /(\d+)\.(\d+)/);
   our $DEBUG   = 0 unless defined $DEBUG;
   our $ERROR   = '';
   
  @@ -435,7 +435,7 @@
       if (defined $size && ! $size) {
           # caching disabled so load and compile but don't cache
           if ($compiled && -f $compiled 
  -            && (stat($name))[9] <= (stat($compiled))[9]) {
  +            && $self->_mtime($name) <= (stat($compiled))[9]) {
               $data = $self->_load_compiled($compiled);
               $error = $self->error() unless $data;
           }
  @@ -770,9 +770,10 @@
       my $size = $self->{ SIZE };
       my ($slot, $head);
   
  -    # extract the load time and compiled template from the data
  -#    my $load = $data->{ load };
  -    my $load = (stat($name))[9];
  +    # check the modification time
  +    my $load = $self->_mtime($name);
  +
  +    # extract the compiled template from the data hash
       $data = $data->{ data };
   
       $self->debug("_store($name, $data)") if $self->{ DEBUG };
  @@ -916,6 +917,12 @@
   }
   
   
  +sub _mtime {
  +    my ($self, $name) = @_;
  +    my $load = (stat($name))[9];
  +    return $load;
  +}
  +
   #------------------------------------------------------------------------
   # _dump()
   #
  @@ -1489,12 +1496,12 @@
   
   =head1 VERSION
   
  -2.85, distributed as part of the
  -Template Toolkit version 2.15, released on 30 January 2006.
  +2.87, distributed as part of the
  +Template Toolkit version 2.14a, released on 02 February 2006.
   
   =head1 COPYRIGHT
   
  -  Copyright (C) 1996-2004 Andy Wardley.  All Rights Reserved.
  +  Copyright (C) 1996-2006 Andy Wardley.  All Rights Reserved.
     Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
   
   This module is free software; you can redistribute it and/or