----- 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 _.


If you can find any explanation...

pascal barbedor



code run
: --------------------------------------------------------------------------
------------------


print -s 'l:/config.pm',"\n", -M _,"\n";



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 _;

 }


}

----------------------------------------------------------------------------
----------------------------------------------------------------------------
-----------
output of code (see that the first stat worked and gives an age of very few
fraction of days, where reread_conf gives 66 days.)
with -M _ last line

983
0.00259259259259259
different

mod: :
different

mod: :67.2868981481481
different

mod:67.2868981481481 :67.2868981481481
different

mod:67.2868981481481 :67.2868981481481
different

mod:67.2868981481481 :67.2868981481481
different

mod:67.2868981481481 :67.2868981481481
different

mod:67.2868981481481 :67.2868981481481
different

mod:67.2868981481481 :67.2868981481481
different

mod:67.2868981481481 :67.2868981481481
different

mod:67.2868981481481 :67.2868981481481

Bonne exécution du processus

----------------------------------------------------------------------------
---------------------
output of code with -M $file last line

983
0.0047337962962963
different

mod: :
same
same
same
same
same
same
same
same
same

Bonne exécution du processus


----------------------------------------------------------------------------
------
config.pm file


package AFPA::Evolif::Config ;

use XML::LibXML () ;
use XML::LibXSLT () ;
use XML::XPath () ;
use XML::Simple () ;
use DBI () ;

my $base='l:/perlinclude';

$CHASH{pconn}->disconnect() if $CHASH{pconn};


our  %CHASH = (

indicateurs =>
XML::LibXML->new->parse_file('l:/perlinclude/indicateurs.xml')
,
glups  =>
XML::LibXSLT->new->parse_stylesheet
(XML::LibXML->new->parse_file("l:/perlinclude/glups.xsl"))
,
groupes =>XML::XPath->
  new(filename=>"l:/perlinclude/categories/groupements.xml")
,
zones =>XML::XPath->
  new(filename=>"l:/perlinclude/categories/decoupages.xml")
,
select=>XML::LibXSLT->new->parse_stylesheet
(XML::LibXML->new->parse_file("l:/perlinclude/evselecteur.xsl"))
,
pconn=>DBI->connect("DBI:mysql:database=evolif;host=localhost",
   "pconn",
   undef,
    {RaiseError=>1}
   )
,


) ;


#my $stylesheet=

#  XML::LibXSLT->new->parse_stylesheet (F_GLUP_XML);


#print $stylesheet->transform(F_IND_XML);


1 ;








Reply via email to