|Perl: the Markov chain saw|
Embed: Using load_moduleby sjfloat (Novice)
|on May 23, 2006 at 20:56 UTC||Need Help??|
sjfloat has asked for the
wisdom of the Perl Monks concerning the following question:
I'm writing C code that that calls perl. The perl code is in the form of a .pm that will be installed in the usual way. The approach I have taken is to call load_module something like:
I follow this by pushing the module name onto the stack and instantiating an object by calling call_method("new", G_SCALAR));
I then push the resulting object and some args onto the stack and invoke call_method on the method name. It seems to necessary to call perl_parse, so I do, passing in "/dev/null" as the file name.
All this actually seems to work pretty swell, but I've encountered one difficulty. Any diagnostics originating in the perl code, e.g. "warn"s, etc., give bogus file and line numbers presumably because, having been pulled in via the load_module call, the code was never parsed: Bad data at /dev/null line 0
I'd like to use the load_module mechanism and yet have the perl interpretter informed of code, for diagnostic reference.
[I can post more code, if helpful. But the actual code is on an isolated host, inaccessible by network.]