On 5/20/08, André Warnier <[EMAIL PROTECTED]> wrote:
> If you never modify this object after creation, then the answer given by
> Michael Peters is the one you are looking for.
>
>  But make sure that the object is indeed never modified (or that what is
> modified does not matter).  I have not looked at the QueryData.pm module you
> mention, but it might be that it modifies it's internal state at each query.
>  This may or may not be important in your case.
>
>  André
>
>
>
>  william wrote:
>
> > On 5/20/08, André Warnier <[EMAIL PROTECTED]> wrote:
> >
> > >
> > >  william wrote:
> > >
> > >
> > > > On 5/20/08, william <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > > > Hello, I just know that I can't have a startup script, but how can I
> > > > >  create an object in the startup script and then used that variable
> > > > >  object in child modperl script ? Thanks.
> > > > >
> > > > >
> > > > >
> > > > Sorry I mean I CAN have a startup script.
> > > >
> > > >
> > > >
> > >  Hi.
> > >
> > >  Take this as a not really qualified answer, but until one of the gurus
> here
> > > jumps in, it may be a start.
> > >
> > >  The simple question you are asking above is in fact very complicated.
> > >  If the idea of your question is to create some variable once at the
> server
> > > start, and then be able to share that variable through multiple
> invocations
> > > of a script or module, then you will probably not be able to do that, or
> at
> > > least not in a simple way.
> > >  The first thing that happens, is that there are multiple Apache
> children
> > > processes started and running at the same time, and that you never know
> > > which one is going to execute your script.  And each one of these
> children
> > > processes, will have its own independent copy (or instance) of your
> "common"
> > > variable (or object).  So the variable will not really be common.
> > >
> > >  There are some ways around that, involving shared memory.  But it is
> > > probably anyway more complicated that what your simple question above
> seems
> > > to indicate of what you expect.
> > >
> > >  Let me make a prediction : I can see a quite long and interesting
> thread
> > > starting here..
> > >
> > >  André
> > >
> > >
> > >
> >
> > Thanks for the prompt reply, you said that every child process have a
> > copy of the common object variable. I think that shouldn't be a
> > problem in my case, because it's an object that only gives data, in
> > contrast we would not modify anything about the object. Specifically,
> > I want to achieve this because the problem of this module
> > WordNet::QueryData
> >
> http://search.cpan.org/~jrennie/WordNet-QueryData-1.47/QueryData.pm
> .
> > This initialization step is slow (appx. 10-15 seconds), but queries
> > are very fast thereafter---thousands of queries can be completed every
> > second. In my hardware it only takes 2 seconds, but that still quite a
> > lot of time to wait if every child process need to take 2 seconds.
> > Unless I can have a permanent in startup script and used by the child
> > process. Thanks
> >
> >
>


Then I would need to modify the QueryData module then, by modifying
the standard module would it make my future maintenance more
complicated ? Do you have any tips for me ?

Btw, I love to know the potential solution for object that would be
modified by the child process ? The child that obtain the object must
have the property of the object that last modified. Because I guess I
am going to face the problem quite soon.
Thanks.

Reply via email to