perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl/lib/Apache StatINC.pm
Date Thu, 14 Jun 2001 16:38:28 GMT
dougm       01/06/14 09:38:27

  Modified:    .        Changes ToDo
               lib/Apache StatINC.pm
  Log:
  make sure file to be reloaded can be found in @INC
  
  Revision  Changes    Path
  1.599     +4 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.598
  retrieving revision 1.599
  diff -u -r1.598 -r1.599
  --- Changes	2001/06/14 05:26:27	1.598
  +++ Changes	2001/06/14 16:38:15	1.599
  @@ -10,6 +10,10 @@
   
   =item 1.25_01-dev
   
  +make sure file to be reloaded can be found in @INC, adjusting based on
  +%INC value if needed
  +[Ilya Konstantinov <modperl@future.galanet.net>]
  +
   croak if the filehandle passed to $r->send_fd is NULL, otherwise
   apache will segfault
   
  
  
  
  1.284     +0 -2      modperl/ToDo
  
  Index: ToDo
  ===================================================================
  RCS file: /home/cvs/modperl/ToDo,v
  retrieving revision 1.283
  retrieving revision 1.284
  diff -u -r1.283 -r1.284
  --- ToDo	2001/06/14 16:14:58	1.283
  +++ ToDo	2001/06/14 16:38:18	1.284
  @@ -51,8 +51,6 @@
   
   - Apache::FakeRequest improvments [Gary Richardson <gary@atdot.org>]
   
  -- Apache::StatINC patch [Ilya Konstantinov <modperl@future.galanet.net>]
  -
   - From: Dave Rolsky <autarch@urth.org>
     Subject: Apache::test patch
   
  
  
  
  1.15      +26 -4     modperl/lib/Apache/StatINC.pm
  
  Index: StatINC.pm
  ===================================================================
  RCS file: /home/cvs/modperl/lib/Apache/StatINC.pm,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StatINC.pm	2000/03/07 02:50:38	1.14
  +++ StatINC.pm	2001/06/14 16:38:24	1.15
  @@ -11,7 +11,7 @@
   				   $r->dir_config("UndefOnReload")) || '') eq "on");
       my $DEBUG = ref($r) && (lc($r->dir_config("StatINCDebug") || '') eq "on");
       $DEBUG = $r->dir_config("StatINC_Debug") if ref($r) && $r->dir_config("StatINC_Debug");
  -    
  +
       while(my($key,$file) = each %INC) {
   	local $^W = 0;
   	my $mtime = (stat $file)[9];
  @@ -20,16 +20,38 @@
   	unless(defined $Stat{$file}) { 
   	    $Stat{$file} = $^T;
   	}
  +        # if modified, reload the module
   	if($mtime > $Stat{$file}) {
  +	    # make sure file's prefix is in @INC
  +	    my $found_in_inc;
  +	    for (@INC) {
  +	       if(index($file,$_) == 0) {
  +	          $found_in_inc = 1;
  +	          last;
  +	       }
  +	    }
  +
  +            if(!$found_in_inc) {
  +               my $inc_dir = substr($file, 0, length($file)-length($key)-1);
  +               push @INC, $inc_dir;
  +	       warn "Apache::StatINC: process $$ adding $inc_dir to \@INC\n"
  +                   if $DEBUG > 0;
  +            }
  +
   	    if($do_undef and $key =~ /\.pm$/) {
   		require Apache::Symbol;
   		my $class = Apache::Symbol::file2class($key);
   		$class->Apache::Symbol::undef_functions( undef, 1 );
   	    }
   	    delete $INC{$key};
  -	    require $key;
  -	    warn "Apache::StatINC: process $$ reloading $key\n"
  -		if $DEBUG > 0;
  +	    eval{ require $key };
  +	    if ($@) {
  +               warn "Apache::StatINC: process $$ failed to reload $key. $@"
  +                  if $DEBUG > 0;
  +	    } else {
  +	       warn "Apache::StatINC: process $$ reloading $key.\n"
  +                  if $DEBUG > 0;
  +            }
   	}
   	$Stat{$file} = $mtime;
       }
  
  
  

Mime
View raw message