For others' reference, the issue I was running into was that the parent pool interpreter was alloc'ed and construct'ed, but it turns out I needed to actually run it to force it to tie STDOUT + STDERR (and, presumably, STDIN). So now I have something like this:

char *argv[] = { "", "-e", "0" };
perl_parse(perl, NULL, 3, argv, NULL);
perl_run(perl);

If I do that before I start cloning the children, everything works great. Thanks to everyone who pitched in ideas.


Jeremy Redburn wrote:
Jeremy Redburn wrote:

Nick Ing-Simmons wrote:

Jeremy Redburn <[EMAIL PROTECTED]> writes:

Hello, I have some code which maintains a pool of Perl interpreters in C and allocates an interpreter as requests come in. It works well enough, but I have run into an issue that my embedded Perl code cannot print to STDOUT or STDERR.




What happens - what does $! show?



I have this statement in my code:

print STDERR "Testing" || print LOG "Error: $!"

Nothing gets printed to the terminal, and LOG doesn't have any content. I can print to LOG fine if I do it directly.


Thanks to Garry Williams, I realized this of course will not work. When I change '||' to 'or' I do get an error:


Error: Bad file descriptor

Any ideas?



Reply via email to