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

2010-12-02 Thread Xiao Lan
2010/12/2 Torsten Förtsch : > On Thursday, December 02, 2010 14:26:36 Xiao Lan wrote: >> > But, looking at the module I think it can be slow because it relies >> > heavily on seek(). A better approach would be to mmap() the file. In >> > perl it would look then like a big string. My favourite tool

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

2010-12-02 Thread Torsten Förtsch
On Thursday, December 02, 2010 14:26:36 Xiao Lan wrote: > > But, looking at the module I think it can be slow because it relies > > heavily on seek(). A better approach would be to mmap() the file. In > > perl it would look then like a big string. My favourite tool for that is > > File::Map. > > O

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

2010-12-02 Thread Xiao Lan
On Thu, Dec 2, 2010 at 9:39 PM, Hendrik Schumacher wrote: > > "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. > > AH thanks

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

2010-12-02 Thread Hendrik Schumacher
Am Do, 2.12.2010, 14:24, schrieb Xiao Lan: > On Thu, Dec 2, 2010 at 5:58 PM, Hendrik Schumacher > 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 (no

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

2010-12-02 Thread Xiao Lan
2010/12/2 Torsten Förtsch : > > But, looking at the module I think it can be slow because it relies heavily on > seek(). A better approach would be to mmap() the file. In perl it would look > then like a big string. My favourite tool for that is File::Map. > OK thanks for this info. I will take a

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

2010-12-02 Thread Xiao Lan
On Thu, Dec 2, 2010 at 5:58 PM, Hendrik Schumacher 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'); > }

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

2010-12-02 Thread Torsten Förtsch
On Thursday, December 02, 2010 02:24:32 Xiao Lan wrote: > I was giving the example by openning a file. > In acutal I was using this module: > > http://search.cpan.org/~sunnavy/IP-QQWry-0.0.16/lib/IP/QQWry.pm > > For each client request if I open the data file: > > my $qqwry = IP::QQWry->new('QQW

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

2010-12-02 Thread Hendrik Schumacher
Am Do, 2.12.2010, 02:24, schrieb Xiao Lan: > On Thu, Dec 2, 2010 at 3:38 AM, Mithun Bhattacharya > wrote: >> Can you confirm the error you are encountering using your current method >> ? >> >> I would like to understand what you are trying to achieve by having a >> global file handle - do you want

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

2010-12-01 Thread Xiao Lan
On Thu, Dec 2, 2010 at 3:38 AM, Mithun Bhattacharya wrote: > Can you confirm the error you are encountering using your current method ? > > I would like to understand what you are trying to achieve by having a global > file handle - do you want to have modular code or does the content of the > f

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

2010-12-01 Thread Mithun Bhattacharya
Can you confirm the error you are encountering using your current method ? I would like to understand what you are trying to achieve by having a global file handle - do you want to have modular code or does the content of the file somehow determine which handler to be used ? You can have modula

How to pre-open files in apache's processes

2010-12-01 Thread Xiao Lan
Hello, I want to pre-open files in apache's processes. So every modperl handlers will use the file handle directly, instead of re-openning the files each time when the requesting is coming. Currently I do it with: package Fileopen; use strict; require Exporter; our @ISA = qw(Exporter); our @EXP