Re: How to pre-open files in apache's processes

"Hendrik Schumacher" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Am Do, 2.12.2010, 14:24, schrieb Xiao Lan:
> On Thu, Dec 2, 2010 at 5:58 PM, Hendrik Schumacher <[email protected]>
> wrote:
>
>>
>> In the perl file that holds your handler declare a variable on module
>> level:
>>
>> my $qqwry = undef;
>>
>> In the handler instantiate the object if $qqwry is undefined:
>>
>> if (not $qqwry)
>> {
>> Â$qqwry = IP::QQWry->new('QQWry.Dat');
>> }
>>
>> This way the file should be opened only once in each apache process
>> (which
>> should be good enough for performance reasons). The my $qqwry on module
>> level should be persistent in each process.
>>
>
>
> Hi,
>
> I'm not sure, what's "the perl file that holds your handler"?
> My hanlder is a perl package, which file will hold this package?
>
> Thanks.
>

"In the perl file that holds your handler" means your perl package file.
Sounds more difficult as it was meant. The important thing is that the
variable has to be declared on package level, not inside a sub routine.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.