Re: How to re-"use Module" if the Module has changed?
- From: "DJ Stunks" <DJStunks@xxxxxxxxx>
- Date: 31 Jan 2006 11:25:01 -0800
andrew.fabbro@xxxxxxxxx wrote:
> What I'd like to do is have the module reread its config if it gets a
> HUP signal. But how can I say "go and 'use Module' again"? It appears
> that if you 'use Module' more than once, subsequent calls are ignored.
>>From the Perl Cookbook:
17.16. Restarting a Server on Demand
Problem
You want your server to shutdown and restart when it receives
a HUP signal, just like inetd or httpd .
Solution
Catch the SIGHUP signal, and re-execute your program:
$SELF = "/usr/local/libexec/myd"; # which program I am
@ARGS = qw(-l /var/log/myd -d); # program arguments
$SIG{HUP} = \&phoenix;
sub phoenix {
# close all your connections, kill your children, and
# generally prepare to be reincarnated with dignity.
exec($SELF, @ARGS) or die "Couldn't restart: $!\n";
}
-jp
.
- Follow-Ups:
- Re: How to re-"use Module" if the Module has changed?
- From: Uri Guttman
- Re: How to re-"use Module" if the Module has changed?
- References:
- How to re-"use Module" if the Module has changed?
- From: andrew . fabbro
- How to re-"use Module" if the Module has changed?
- Prev by Date: Re: split the sequences
- Next by Date: Re: How to re-"use Module" if the Module has changed?
- Previous by thread: Re: How to re-"use Module" if the Module has changed?
- Next by thread: Re: How to re-"use Module" if the Module has changed?
- Index(es):
Relevant Pages
|