First of, maybe this should go to macperl-anyperl, as technically I'm doing this under 
Windows.  

However, my question is not Windows specific.  

I have a C program that I've embedded perl into, to provide some advanced 
configuration and data processing.  I didn't want to dig around and find some strange 
regex library and match it with some other hash table library, nor code my own.  So 
embedding perl seemed the way to go.

It works.  So that's the good part.  

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? 

-Jeff Lowrey

Reply via email to