Changeset 13811


Ignore:
Timestamp:
01/24/12 09:31:40 (4 weeks ago)
Author:
OlivierRaginel
Message:

Item11458: Try to optimise filesystem accesses by minimizing stat() calls. Also Sven, 3 arguments open!!!

Location:
trunk/core/lib/Foswiki
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki/Templates.pm

    r13537 r13811  
    612612        $tmpl_cachedir . '/' . $name . '__' . $skins . '__' . $web . '.tmpl' ); 
    613613 
    614     unless ( open( FILE, ">$filename" ) ) { 
     614    unless ( open( my $file, '>', $filename ) ) { 
    615615        die "Can't create file $filename - $!\n" if DEBUG; 
    616616        print STDERR "Can't create file $filename - $!\n"; 
     
    618618        return; 
    619619    } 
    620     print FILE $tmplText; 
    621     close(FILE); 
     620    print $file $tmplText; 
     621    close($file); 
    622622} 
    623623 
     
    634634 
    635635    if ( -e $filename ) { 
    636         open( IN_FILE, "<$filename" ) || return; 
     636        open( my $in_file, '<', $filename ) or return; 
    637637        local $/ = undef;    # set to read to EOF 
    638         my $data = <IN_FILE>; 
    639         close(IN_FILE); 
     638        my $data = <$in_file>; 
     639        close($in_file); 
    640640        return $data; 
    641641    } 
  • trunk/core/lib/Foswiki/Users/ApacheHtpasswdUser.pm

    r13796 r13811  
    122122 
    123123    # We expect the path to exist and be writable. 
    124     return 0 if ( -e $path && -f $path && -w $path ); 
     124    return 0 if ( -e $path && -f _ && -w _ ); 
    125125 
    126126    # Otherwise, log a problem. 
  • trunk/core/lib/Foswiki/Users/HtPasswdUser.pm

    r13796 r13811  
    163163 
    164164    # We expect the path to exist and be writable. 
    165     return 0 if ( -e $path && -f $path && -w $path ); 
     165    return 0 if ( -e $path && -f _ && -w _ ); 
    166166 
    167167    # Otherwise, log a problem. 
     
    228228        && -e $Foswiki::cfg{Htpasswd}{FileName} ) 
    229229    { 
    230         my $fileTime = ( stat( $Foswiki::cfg{Htpasswd}{FileName} ) )[9]; 
     230        my $fileTime = ( stat(_) )[9]; 
    231231        $this->ClearCache() 
    232232          if ( $fileTime > $this->PasswordTimestamp() ); 
Note: See TracChangeset for help on using the changeset viewer.