>I suggest loading the module in the parent but not opening any
>connections until after the fork.
>

How to write the codes then?Currently I've written it as:

sub handler
{
    my $r = shift;
    my $q = Apache::Request->new($r);
    ...
    my $memd = new_memcached();   # open the socket to memcached
    #codes for querying memcached
    ....
    $memd->disconnect_all;  # disconnected from memcached

    return OK;
}


Do you mean we can write it like below?

my $memd = new_memcached(); 
sub handler
{
    my $r = shift;
    my $q = Apache::Request->new($r);
    #codes for querying memcached
    ...
   
    return OK;
}
$memd->disconnect_all;


Thanks for more suggestions.

--
Jeff Pang
EMAIL: pangj<at>earthlink.net  AIM: jeffpang

Reply via email to