> That, unfortunately doesn't tell me what causes a USR2 signal to
> be sent to
> Apache. Or when it's caused. I only want to reload the file when
> said file
> has changed. Am I supposed to do some checking against the file -M time
> myself, and then send a USR2 signal myself?

USR2 only fires when you do it yourself, e.g.
kill -USR2 `cat /var/run/httpd.pid`
or under linux
killall -USR2 httpd

However, if you want to change based on mod time, then one way to do it
would be as follows (THIS CODE IS UNTESTED!!!).

in the handler/CGI that USES the 700k doc:

my $big_doc = My::get_big_doc();

and in startup.pl you can say:

package My;

my $big_doc = undef;
my $mod_time = 0;

my $big_file = '/path/to/big/file';

sub get_big_doc {

    if (defined $big_doc and -M $big_file < $mod_time) {
        return $big_doc;
    } # implicit else

    ($big_doc, $mod_time) = some_complex_operation();

    return $big_doc;

}

sub some_complex_operation {

        # read in $big_doc and its $mod_time

        return ($big_doc, $mod_time);
}

HTH!

L8r,
Rob

#!/usr/bin/perl -w
use Disclaimer qw/:standard/;


Reply via email to