At 11:39 -0500 2002.07.15, Jefferson R. Lowrey wrote:
>However, for what I'm doing I need a persistant interpreter that uses a
>dynamic >configuration.  Here's how I attempted to approach this:
>At program startup, create a persistant interpreter
>Write a perl sub that uses 'require' to reload the configuration (as the
>configuration is stored as a perl hash).
>Repeatedly call this perl sub using call_pv.
>At program shut down, destroy the perl interpreter.
>
>Unfortunately, the configuration does not seem to get reloaded every time I
>call my sub, it only seems to get reloaded when I start my program up.
>
>I'm using perl_parse to load in the script file at startup.  Should I be
>calling perl_parse every time, before I use call_pv?  I didn't want to do
>that, >as I also need to maintain some persistant memory between calls to
>my sub, and
>was concerned that perl_parse would blow them away.
>
>Should I be using something other than call_pv to execute my sub?  Should I be
>using exec or use instead of require?

Well, you can try a few things.  I don't know much about embedding perl,
but one idea is to look into using MULTIPLICITY, which allows multiple
interpreter instances to occur in one program.  Another is to use "do
'config.pl'" instead of "require", or before the "require" clear out %INC
(which is what it used by perl to remember what files have been
used/required so they are not re-loaded).

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to