Re: RFC: Apache::Reload

2000-08-12 Thread Matt Sergeant

On Fri, 11 Aug 2000, Ken Williams wrote:

 Hi Matt,
 
 Is it possible that this functionality should be integrated into
 Apache::StatInc?  Perhaps with a couple of new directives to control
 behavior?

Thats a difficult one... Of course its possible to do, but is it
sensible? It would basically make StatINC a two-mode module. In one mode
it stats @INC, like its name suggests, and in another it only stats
modules that have use()'d it. I would have thought Apache::Reload would
then be a better name for it, overall. I also don't think these two bits
of functionality need to be in the same module, although they do use parts
of the same op code tree. I'd like to hear a bit more discussion about it
before I go about patching StatINC.pm

I know they're busy, but if the main mod_perl maintainers have anything to
add, I'd be very interested.

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Re: RFC: Apache::Reload

2000-08-12 Thread Ken Williams

Matt Sergeant's message:

On Fri, 11 Aug 2000, Ken Williams wrote:

 Hi Matt,
 
 Is it possible that this functionality should be integrated into
 Apache::StatInc?  Perhaps with a couple of new directives to control
 behavior?

Thats a difficult one... Of course its possible to do, but is it
sensible? It would basically make StatINC a two-mode module. In one mode
it stats @INC, like its name suggests, and in another it only stats
modules that have use()'d it. I would have thought Apache::Reload would
then be a better name for it, overall.

That seems right - so perhaps it would be better to integrate the
StatINC functionality into Apache::Reload than the other way around.
If it's called Apache::Reload, then it might make sense to have a
directive like 'ReloadMode' that could be set to 'INC' to emulate
StatINC's behavior, or to 'Files' to explicitly name the files you
want checked with every request, or to 'Slave' (perhaps a bad choice)
to only check those files that do the "use Apache::Reload" thingy
you've written.

'Files' and 'INC' wouldn't be very different in implementation, but
'Files' gives you finer-grained control.  They both just take a list
of files and check them with every request.

One nice thing about this approach is that you could set the
ReloadMode differently for different URI files/directories in
httpd.conf, so you wouldn't have to shotgun your entire site when you
just need to test one little thing in your private area.

It might be nice to have only one [main] module for reloading changed
code files, both because of memespace issues and because the actual
reloading task seems to be a tricky one, and it would be nice to only
have to get it right once.  But if it doesn't make sense to combine
the approaches into one module, it doesn't make sense.


-Ken Williams
 The Math Forum
 [EMAIL PROTECTED]



Re: RFC: Apache::Reload

2000-08-12 Thread Ken Williams

Matt Sergeant's message:

On Sat, 12 Aug 100, Ken Williams wrote:

 That seems right - so perhaps it would be better to integrate the
 StatINC functionality into Apache::Reload than the other way around.
 If it's called Apache::Reload, then it might make sense to have a
 directive like 'ReloadMode' that could be set to 'INC' to emulate
 StatINC's behavior, or to 'Files' to explicitly name the files you
 want checked with every request, or to 'Slave' (perhaps a bad choice)
 to only check those files that do the "use Apache::Reload" thingy
 you've written.

Apart from the name "Slave" I think its right on the money :)

I think Required or Imported would be better.


Perhaps 'Import'?  Sounds more like a mode name to me than 'Imported'.
Or 'Register'?


-Ken Williams
 The Math Forum
 [EMAIL PROTECTED]



$$foo in Apache::ASP

2000-08-12 Thread Rod Butcher

I'm running Apache 1.12, Mod_Perl 1.23, Apache::ASP 2.03 on NT.
I can't get the construct
%
$foo = "xxx";
$$foo="yyy";
%
to populate $xxx with "yyy". Works in normal Perl.

Any sugeestions ?
Thanks
Rod




Re: $$foo in Apache::ASP

2000-08-12 Thread Randal L. Schwartz

 "Rod" == Rod Butcher [EMAIL PROTECTED] writes:

Rod I'm running Apache 1.12, Mod_Perl 1.23, Apache::ASP 2.03 on NT.
Rod I can't get the construct
Rod %
Rod $foo = "xxx";
Rod $$foo="yyy";
Rod %
Rod to populate $xxx with "yyy". Works in normal Perl.

For an odd definition of "works".  As in, ***HIGHLY DISCOURAGED***.

See http://www.plover.com/~mjd/perl/varvarname.html, et. seq.

It's proabably a Very Good Thing that ASP enables "use strict" for
you, to keep you from going down the Wrong Path.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



[ANNOUNCE] Apache::Reload 0.02

2000-08-12 Thread Matt Sergeant

The uploaded file

Apache-Reload-0.02.tar.gz

has entered CPAN as

  file: $CPAN/authors/id/M/MS/MSERGEANT/Apache-Reload-0.02.tar.gz
  size: 2284 bytes
   md5: 37c950bd5b8ef3238d14be207766e651

No action is required on your part
Request entered by: MSERGEANT (Matt Sergeant)
Request entered on: Sat, 12 Aug 2000 16:14:32 GMT
Request completed:  Sat, 12 Aug 2000 16:14:44 GMT

Virtually Yours,
Id: paused,v 1.68 1999/10/22 14:39:12 k Exp k 

Changes:

This version now by default emulates Apache::StatINC. There is a new
option ReloadAll which you have to set to Off to use the older
functionality. See the docs for details.

Matt.




Re: RFC: Apache::Reload

2000-08-12 Thread Leslie Mikesell

According to Matt Sergeant:
 
 package Apache::Reload;

What I've always wanted along these lines is the ability
to load something in the parent process that would take
a list of directories where modules are always checked
and reloaded (for your local frequently changed scripts)
plus one filename that is checked every time and if it
has been touched then do the full StatINC procedure.  This
would keep the number of stat's down to a reasonable number
for production and still let you notify the server when
you have updated the infrequently changed modules.

  Les Mikesell
   [EMAIL PROTECTED]



Re: RFC: Apache::Reload

2000-08-12 Thread Matt Sergeant

On Sat, 12 Aug 2000, Leslie Mikesell wrote:

 According to Matt Sergeant:
  
  package Apache::Reload;
 
 What I've always wanted along these lines is the ability
 to load something in the parent process that would take
 a list of directories where modules are always checked
 and reloaded (for your local frequently changed scripts)

Right, Ken's list of reloaded files. Plus an option for a directory...

 plus one filename that is checked every time and if it
 has been touched then do the full StatINC procedure.  This
 would keep the number of stat's down to a reasonable number
 for production and still let you notify the server when
 you have updated the infrequently changed modules.

Thats an interesting idea. I'll look into it.

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Re: RFC: Apache::Reload

2000-08-12 Thread Michael Robinton

On Sat, 12 Aug 2000, Leslie Mikesell wrote:

 According to Matt Sergeant:
  
  package Apache::Reload;
 
 What I've always wanted along these lines is the ability
 to load something in the parent process that would take
 a list of directories where modules are always checked
 and reloaded (for your local frequently changed scripts)
 plus one filename that is checked every time and if it


I use this simple library module. It is called from the beginning of the 
first script encountered in a set of scripts. This substitutes for a 
require statement for the corresponding modules.


Call as:

unshift @INC, './lib';
require 'LibChk.pl';
LibChk::Install (# check libraries for currency
'WhoisLib.pl',
'SocksLib.pl',
'DomRegLib.pl',
);




library:

#!/usr/bin/perl
#
# LibChk.pl
#
# version 1.01 6-16-00
# copyright Michael Robinton [EMAIL PROTECTED]
#
#   WARNING!! httpd must be 'HUP'ed if this library is modified
#
# check for library changes and load if necessary or not present
#
package LibChk;
use vars qw ( %Modified );  # library modification times

# Input:list of libraries (path must be in @INC)
sub Install {
  foreach my $i (@_) {
if ( ! exists $Modified{$i} ||  # if undefined time
 ! exists $INC{$i} ||   # missing
 $Modified{$i} != (stat "./$INC{$i}" )[9] ) {   # or changed
  delete $INC{$i} if defined $INC{$i};
  require $i;
  $Modified{$i} = (stat "./$INC{$i}" )[9];
}
  }
}
1;



Re: RFC: Apache::Reload

2000-08-12 Thread Matt Sergeant

On Sat, 12 Aug 100, Ken Williams wrote:

 That seems right - so perhaps it would be better to integrate the
 StatINC functionality into Apache::Reload than the other way around.
 If it's called Apache::Reload, then it might make sense to have a
 directive like 'ReloadMode' that could be set to 'INC' to emulate
 StatINC's behavior, or to 'Files' to explicitly name the files you
 want checked with every request, or to 'Slave' (perhaps a bad choice)
 to only check those files that do the "use Apache::Reload" thingy
 you've written.

Apart from the name "Slave" I think its right on the money :)

I think Required or Imported would be better.

 'Files' and 'INC' wouldn't be very different in implementation, but
 'Files' gives you finer-grained control.  They both just take a list
 of files and check them with every request.

There is some trickiness to it, such as you want to "do" a file, but
"require" a module (%INC gives you modules (and files) whereas Files mode
you'd probably just specify a bunch of files to stat).

 It might be nice to have only one [main] module for reloading changed
 code files, both because of memespace issues and because the actual
 reloading task seems to be a tricky one, and it would be nice to only
 have to get it right once.  But if it doesn't make sense to combine
 the approaches into one module, it doesn't make sense.

One issue that will always remain is the legacy of StatINC...

But this gives me something fun to hack on after I walk the dogs today :)

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org




Re: $$foo in Apache::ASP

2000-08-12 Thread Matt Sergeant

On Sat, 12 Aug 2000, Rod Butcher wrote:

 I'm running Apache 1.12, Mod_Perl 1.23, Apache::ASP 2.03 on NT.
 I can't get the construct
 %
 $foo = "xxx";

You need to turn off strict here:

no strict 'refs';

 $$foo="yyy";
 %
 to populate $xxx with "yyy". Works in normal Perl.
 
 Any sugeestions ?
 Thanks
 Rod
 
 

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org