pascal barbedor wrote: > hello, > > > > I am reading mod_perl guide and i had a problem with a piece of code in > chapter 9.7.4.2 about > > reloading configuration files. this is version jan 2001 but i have > checked in the last one the piece of code is the same. > > > > when running the code exactly, things don't work, even outside mod_perl > environnment. > > > > the sub below print file is different even though I don't change the file. > > > > I have located that if i change $MODIFIED{$file} = -M _; to an > explicit $MODIFIED{$file} = -M $file;
That's weird. _ uses the cached stat's output from the last stat call. Does this work for you? perl -e '-s "/etc/passwd"; print -M _' use some existing file of course. > in the last line, everything works fine. > > > > > > since i do no test on any other file and I have understood that _ > account s for the last file tested, I don't understand why it does work. > > I am on NT4 perl 5.6.1 > > try it yourself ! so strange ! > > > > > > thanks for any explanation > > > > > > ********************************* > > > > for (1..10){ > > > > reread_conf("l:/asperl/site/lib/afpa/evolif/config.pm"); > > > > sleep 2; > > > > } > > > > > > > > our %MODIFIED; > > > sub reread_conf{ > > > > my $file=shift; > > > > return unless $file; > > > > return unless -e $file and -r _; > > > > if ($MODIFIED{$file} and $MODIFIED{$file}== -M _){ > > > > print "same" ; }else {print "different";} > > > > print "\n"; > > > > > unless ($MODIFIED{$file} and $MODIFIED{$file}== -M _){ > > > unless (my $result = do $file) { > > warn ... > > > > } > > > > > print "\nmod:",$MODIFIED{$file},' :', -M _,"\n"; > > > > $MODIFIED{$file} = -M _; > > > > } > > > > > } > > > > > -- _____________________________________________________________________ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/