----- Original Message ----- From: "pascal barbedor" <[EMAIL PROTECTED]> To: "Stas Bekman" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, October 07, 2001 12:03 PM Subject: Re: piece of code in mod_perl guide
> > ----- Original Message ----- > From: "Stas Bekman" <[EMAIL PROTECTED]> > To: "pascal barbedor" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Sunday, October 07, 2001 2:22 PM > Subject: Re: piece of code in mod_perl guide > > > > 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 _' > > > > yes it works, but the piece of code in mod_perl guide does not work, on my > specific config.pm, I don't understand why. > see below, the code, the output of the code, the config file . > > In fact, it looks like when I try it on any other file that my config file, > it works. or it works on my config file with the explicit -M $file instead > of -M _. > > for (1..10){ reread_conf("l:/config.pm") } > 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){ > print "lecture\n"; > warn "lecture de $file impossible: $@" if $@; > warn "do de $file impossible: $!" unless defined $result; > warn "run de $file impossible" unless $result; > } > print "\nmod:",$MODIFIED{$file},' :', -M _,"\n"; > $MODIFIED{$file} = -M _ > } > } > [ .... ] > config.pm file > --------------------------------------------- > package AFPA::Evolif::Config ; > > use XML::LibXML () ; > use XML::LibXSLT () ; > use XML::XPath () ; > use XML::Simple () ; > use DBI () ; [ ... ] Hi, Could it be that XML::XPath does file tests on the file $xmlfile passed to it through XML::XPath->new(filename => $xmlfile) which would cause '_' to use the stat on $xmlfile, rather than the original config file? best regards, randy kobes