On Tuesday, October 21, 2003, at 05:52AM, <[EMAIL PROTECTED]> wrote:
>First off version info. I am running perl 5.6.1 which I got pre-built from: > > ftp://ftp.sidhe.org/perl-5_6_1-vmsaxp-7_2-1.zip The HP PCSI kit of 5.6.1 has a couple of tweaks and bug fixes not in this version, including one or two that affect embedding. However, this version has a number of extensions conveniently bundled with it that are not in the HP kit. Note that 5.8.1 is now out and available. >I have tried some of the techniques described in PERLEMBED.POD but none of them >seem to allow me to do exactly what I need to do. The perl_run() stuff sounded >promising but > > 1) I couldn't get output re-direction to work at all. No matter what I did > when I called perl_run() to invoke the SPAMASSASSIN script it sent its output > to the terminal, not the file > > - Tried redefining sys$output varying access mode and logical name table. > - Tried playing with stdout. > > 2) I could only get input re-direction to work (by calling crelnm to > DEFINE/USER SYS$INPUT to the input file) for the first input file but on > subsequent calls to perl_run() I couldn't get it to read a different file. I > also tried playing with stdin with no success. > > 3) I couldn't figure out how to pass command line options (aka. invocation > options?) to the SPAMASSASSIN script. John may well be right that a separate server process is the way to go. However, what you are attempting should be possible. Because command redirection is done by Perl on VMS and not by the shell, you have to invoke a special pre-processor just like a standalone version of Perl does. See the macro PERL_SYS_INIT3 as used in the file miniperlmain.c in the Perl distribution. The perlembed docs skip this for simplicity -- I suggest referring to miniperl as your embedding example rather than the one given in perlembed.pod. You should be able to pass arguments to your script by creating and populating your own argc and argv before passing them to PERL_SYS_INIT3 and perl_parse(). These don't have to be the arguments from the main() function of your C program -- make them whatever you want. See the last example in perlembed at <http://www.perldoc.com/perl5.8.0/pod/perlembed.html>. HTH.
