Loading ...
Sorry, an error occurred while loading the content.

Re: [mp2][PATCH] enhancement for Apache::Reload

Expand Messages
  • Andreas Bauer
    Hi Stas, sorry for the delay. ... Ok, I did the ReloadTrace thing with info and debug as possible values. It should not be difficult to add support for
    Message 1 of 3 , Jun 1, 2004
    • 0 Attachment
      Hi Stas,
      sorry for the delay.

      On Friday 14 May 2004 20:14, Stas Bekman wrote:
      >
      > It could be better to have:
      >
      > PerlSetVar ReloadTrace debug
      > PerlSetVar ReloadTrace info
      > PerlSetVar ReloadTrace error
      >
      > etc. but I don't think we will need more than 2. Whichever way is fine with
      > me. As this is mp2 we can change the API as long as 2.0 is not released. So
      > may be it's better to go with the second idea.

      Ok, I did the ReloadTrace thing with 'info' and 'debug' as possible values. It
      should not be difficult to add support for more values.

      > And docs live here:
      > http://perl.apache.org/docs/2.0/api/Apache/Reload.pod.orig

      Reload.pm patch:

      --- Reload.pm.orig 2004-06-01 14:31:33.133067240 +0200
      +++ Reload.pm 2004-06-01 13:54:34.690321800 +0200
      @@ -59,7 +59,11 @@ sub handler {
      my $o = shift;
      $o = $o->base_server if ref($o) eq 'Apache::Connection';

      + my %TRLEV = (''=>0, 'info'=>1, 'debug'=>2);
      my $DEBUG = ref($o) && (lc($o->dir_config("ReloadDebug") || '') eq 'on');
      + my $TRACE = ref($o) && lc($o->dir_config("ReloadTrace"));
      + my $trlev = $TRLEV{($TRACE || ($DEBUG ? 'debug' : ''))};

      my $TouchFile = ref($o) && $o->dir_config("ReloadTouchFile");

      @@ -70,7 +74,7 @@ sub handler {
      my $TouchModules;

      if ($TouchFile) {
      - warn "Checking mtime of $TouchFile\n" if $DEBUG;
      + warn "Checking mtime of $TouchFile\n" if $trlev >= $TRLEV{debug};
      my $touch_mtime = (stat($TouchFile))[9] || return 1;
      return 1 unless $touch_mtime > $TouchTime;
      $TouchTime = $touch_mtime;
      @@ -119,7 +123,7 @@ sub handler {
      while (my($key, $file) = each %Apache::Reload::INCS) {
      next unless defined $file;
      next if @watch_dirs && !grep { $file =~ /^$_/ } @watch_dirs;
      - warn "Apache::Reload: Checking mtime of $key\n" if $DEBUG;
      + warn "Apache::Reload: Checking mtime of $key\n" if $trlev >= $TRLEV{debug};

      my $mtime = (stat $file)[9];

      @@ -150,7 +154,7 @@ sub handler {
      unless $ConstantRedefineWarnings;
      require $key;
      warn("Apache::Reload: process $$ reloading $key\n")
      - if $DEBUG;
      + if $trlev >= $TRLEV{info};
      }
      $Stat{$file} = $mtime;
      }



      Reload.pod patch:

      --- Reload.pod.orig 2004-06-01 14:23:28.675715952 +0200
      +++ Reload.pod.new 2004-06-01 14:23:23.339527176 +0200
      @@ -18,7 +18,7 @@
      PerlInitHandler Apache::Reload
      PerlSetVar ReloadAll Off
      PerlSetVar ReloadModules "ModPerl::* Apache::*"
      - #PerlSetVar ReloadDebug On
      + #PerlSetVar ReloadTrace Info
      #PerlSetVar ReloadConstantRedefineWarnings Off

      # Reload a single module from within itself:
      @@ -183,9 +183,19 @@
      =head1 Debug

      If you aren't sure whether the modules that are supposed to be
      -reloaded, are actually getting reloaded, turn the debug mode on:
      +reloaded, are actually getting reloaded, set the C<ReloadTrace>
      +variable:

      - PerlSetVar ReloadDebug On
      + PerlSetVar ReloadTrace Info
      +
      +To further increase the log output, e.g. showing information about
      +the files that are checked for reloading:
      +
      + PerlSetVar ReloadTrace Debug
      +
      +The C<ReloadDebug> variable used in C<Apache::Reload> v0.09 and
      +earlier is still supported for backward compatibility but usage
      +is discouraged. It will probably be removed in the future.

      =head1 Silencing 'Constant subroutine ... redefined at' Warnings

      > Thanks.

      --
      Report problems: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
      List etiquette: http://perl.apache.org/maillist/email-etiquette.html
    Your message has been successfully submitted and would be delivered to recipients shortly.