I am currently trying to get 5.8.0 to work on VMS 7.3 and having a problem
with how SYS$INPUT is getting set-up when calling system.  Here is the code
I'm testing:
test.pl
-------
system("perl a.pl");

a.pl
-----
$a = $ENV{'SYS$INPUT'};
$b = $ENV{'SYS$COMMAND'};
$c = $ENV{'SYS$OUTPUT'};
print "INPUT: $a\n";
print "COMMAND: $b\n";
print "OUTPUT: $c\n";
$answer = <STDIN>;
print "Received: $answer\n";

Both files are in the same directory.  With a standard build of PERL 5.8.0
this is what I get back when I do
>perl test.pl
INPUT: _TST5$DKA100:
COMMAND: _TST5$FTA195:
OUTPUT: _TST5$FTA195:
Use of uninitialized value in concatenation (.) or string at a.pl line 8.
Received:

I tracked this down to the safe_popen call and I believe that the spawning
of the vmspipe.com file is causing SYS$INPUT to be set up incorrectly.  I
believe that spawning a DCL script causes SYS$INPUT to be set to the script
itself.  So I changed VMS.C to have the following code:
static PerlIO *
safe_popen(pTHX_ char *cmd, char *in_mode, int *psts)
{
    .....
    unsigned short len = 0;
    ....
    $DESCRIPTOR(d_input, "SYS$INPUT");

    } else if (*mode == 'n') {       /* separate subprocess, no Perl i/o */
        /* Translate SYS$INPUT so we can pass it to the DCL script and
           override the SYS$INPUT which will get set to the script itself.
*/
        d_symbol.dsc$w_length = MAX_DCL_SYMBOL;
        _ckvmssts(lib$get_logical(&d_input, &d_symbol, &len, 0, 0, 0, 0,
0));
        symbol[len] = '\0';
        /* Don't know why but lib$get_logical puts something in the first 4
           characters and then puts the logical translation. */
        strncpy(in, symbol+4, 512);

        ...
    }
    ...
}
    I hope that all makes sense.  I'd do a better diff but my diff skills
are poor.  Once I recompiled perl everything worked as planned with test.pl.
I'm not too sure if I'm missing something as this is a fairly important bug
if it is a bug.  I'm compiling perl with just the standard configure and all
the tests passed except for the few known tests that don't.  If anyone could
verify that I'm not out to lunch that would be much appreciated.  Also if
anyone would know what lib$get_logical puts in the first 4 characters of the
array that would also be helpful.

Thanks,

Michael Downey
MegaSys Computer Technologies


Reply via email to