http://qs1969.pair.com?node_id=517494


in reply to Re^4: Doubts of a perl beginner on PERLEMBED
in thread Doubts of a perl beginner on PERLEMBED

If you're calling the Perl code repeatedly from the C, that's a reasonable thing to do, because you need only compile it once.

The best way to do it is probably to make sure all your Perl code is in subroutines (so running the script from the command-line) doesn't actually do anything), and that you don't have any name clashes between the two files. (Use separate packages if necessary.)

Then load both the files in, by parsing (perl_parse) and executing (perl_run) a one-liner that requires them both, as I indicated earlier. Once you've done that, you can call your subs using one of the call_* functions described in perlcall.

Good luck! Embedding perl is a pretty “advanced” topic for a self-described perl beginner. Good for you for not being afraid to try! But don't expect it to be particularly easy or clearly documented...