Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

using <STDIN> in PERL

Barry McClintock
Occasional Contributor

using <STDIN> in PERL

I have a PERL routine which takes input from . Run standalone...eg "PERL works fine.

However, I need to call the PERL routine from a DCL procedure...in this situation doesn't take input from the keyboard....how can I define SYS$INPUT/SYS$COMMAND so that STDIN will work in this circumstance?
4 REPLIES
Hein van den Heuvel
Honored Contributor

Re: using <STDIN> in PERL


Hmmm, works fine for me by doing nothing special.
For example a file tmp.com containing:

$ create tmp.pl
$deck
$param=shift @ARGV;
while () {
print "hello : $param : ".$_;
}
$eod
$ perl tmp.pl xyz
aap
noot
mies
$delete tmp.pl.
$exit


$ @tmp
hello : xyz : aap
hello : xyz : noot
hello : xyz : mies


Now if you wanted the input to come from the terminal that started the command file, then you have to tell DCL that with:
$define/user sys$input sys$command

This is NOT speecific to perl, but standard practice for any DCL command file.
The whole solution then becomes:



$ type tmp.com
$ create tmp.pl
$deck
$param=shift @ARGV;
while () {
print "hello : $param : ".$_;
}
$eod
$define/user sys$input sys$command
$perl tmp.pl xyz
$delete tmp.pl.
$exit

And runs as:

$ @tmp
aap
hello : xyz : aap
noot
hello : xyz : noot
mies
hello : xyz : mies
$

hth,
Hein.

Jan van den Ende
Honored Contributor

Re: using <STDIN> in PERL

Barry,

Already tried

$ DEFINE SYS$INPUT SYS$COMMAND
?

Just meaning, equate the SYS$INPUT (which I guess would be called stdin in the *IXian parlance used by perl) to SYS$COMMAND (the master command level; in interactive sessions equated to the keyboard).

For single-image activities this can be defined /USER_MODE ; if not, then do not forget to DEASSIGN !!

hth

Proost.

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Jan van den Ende
Honored Contributor

Re: using <STDIN> in PERL

Barry,

obviously you were helped well in your question about C header files.

Maybe you should take the time to thank those who helped by assigning some points.

For the "WHY?" and "HOW?", please see:
http://forums1.itrc.hp.com/service/forums/helptips.do?#28

PS. you will have to re-open the thread before you can give points. Afterwards you can close it again.

Proost.

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Barry McClintock
Occasional Contributor

Re: using <STDIN> in PERL

thanks again...I had gotten this but greatly appreciate your prompt reply.

Barry