On Jul 27, 2004, at 6:09 AM, Gopakumar Ambat wrote:

##########perl script:
##########test.pl
use my_test.pm

that should be either "use my_test;" or "require 'my_test.pm';". either way, it needs a semicolon, or you get the syntax error you saw. you also are responsible for making sure this file is available through the perl library search path.


print "inside test.pl script";

don't forget that this probably won't show up until you print a newline to stdout.



My aim is to get the same error message while running the perl script via the embedded C++ application. My understanding is that the error message gets re-directed to "stderr", so I tried closing stderr and reopening with a new file handle, but that doesn't seem to work; no messages get routed to the "new" stderr!! Apparently the "stderr" has been over-riden by the PERL IO layer, and I can't find a way to reset that...

did you do

  fclose (stderr);
  stderr = fopen (...);

or

  close (2);
  dup (otherfd);

?

what i see is that PerlIO_stderr() calls PerlIO_stdstreams(), which, if it hasn't been called before, does PerlIO_fdopen(2, ...). so, in theory, if you redirect stderr's file descriptor before perl sees it, it ought to work.

but, thanks to #ifdef magic, i don't know for sure that this code even gets called on win32, so you will want to take my comments with caution. does win32 even have dup()?


-- Holy crap, dude, we have kids! -- Elysse, six days after giving birth to twins



Reply via email to