I'm sure Peter's reply is more useful, in the sense of giving you something which will 
work; but here's another angle on why your code doesn't.  

I would expect that your code *would* change the default directory of the process 
where it's executed, that is, the new process created by your piped open command.  But 
it won't change the default directory of the original process where you ran Perl.  
(I'm assuming, as I think Peter was, that the latter is what you wanted to do.)

/ Tom Edelson

-----Original Message-----
From: Sandy Fleming [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, September 03, 2002 1:21 PM
To: [EMAIL PROTECTED]
Subject: Set Default not Working


Folks,

I'm new to using Perl in VMS, not quite so new to Perl itself.

I've been using the following as given by David Lyon in the Perl FAQ at
http://www.sidhe.org/vmsperl/vmsperlfaq.html#Q12

open(OUT,"|\@sys\$input"); # mind the backslash in sys$input
print OUT "show default\n"; # or any other command
print OUT "dir/date"; # or any other command
close(OUT);

It works bery nicely with these commands, but I can't get it to work with
SET DEFAULT at all:

open(OUT,"|\@sys\$input");
print OUT "set default $x\n";
close(OUT);

Where the variable $x holds the directory path as a string. This gives no
errors, it just doesn't change the directory default.

The following works fine for displaying the directory even with exactly the
same string in $x:

open(OUT,"|\@sys\$input");
print OUT "directory $x\n";
close(OUT);

Does anyone know why the SET DEFAULT command doesn't work here?

Sandy Fleming
http://scotstext.org/




Reply via email to