Connecting Tech Pros Worldwide Help | Site Map

How to give input to a pvcs command automatically?

Newbie
 
Join Date: Sep 2008
Posts: 6
#1: Oct 26 '08
`vget <program name>` is a PVCS command which gets the program to our home directory. This command is given inside a perl program.

This command needs some input to be given.
Eg. Would you like to display milestone label (Y/N)?

We need to respond to this to get the program. Is there any way that i can give input to this automatically..? say N every time?.
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,565
#2: Oct 26 '08

re: How to give input to a pvcs command automatically?


Quote:

Originally Posted by nirsamp

`vget <program name>` is a PVCS command which gets the program to our home directory. This command is given inside a perl program.

This command needs some input to be given.
Eg. Would you like to display milestone label (Y/N)?

We need to respond to this to get the program. Is there any way that i can give input to this automatically..? say N every time?.

So this is an external command that you are executing inside of your Perl script using back tics. Ok, so if you want to feed it a variable or whatever you need to. Since you have the commands documentation, you need to look to see what it supports for input.

Regards,

Jeff
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#3: Oct 26 '08

re: How to give input to a pvcs command automatically?


Real generic example:

Expand|Select|Wrap|Line Numbers
  1. print "Would you like to display milestone label (Y/N)?";
  2. my $in = <STDIN>;
  3. chomp $in;
  4. # here you would check $in to make sure its what your program expects
  5. # and not just arbitrary input from the user that might be dangerous
  6. my $out = qx{vget $in};
  7. print $out;
  8.  
qx is the same as backticks
Newbie
 
Join Date: Sep 2008
Posts: 6
#4: Oct 29 '08

re: How to give input to a pvcs command automatically?


`vget <program name>` is a PVCS command which gets the program to our home directory. This command is given inside a perl program.

When this command is executed it needs an input to be given in the middle. We need to respond to the below question asked when the command is executed.
Would you like to display milestone label (Y/N)?

Only after we respond to this question the command will execute further. Is there any way that i can give input to this automatically..? say N every time?.
nithinpes's Avatar
Expert
 
Join Date: Dec 2007
Posts: 400
#5: Oct 29 '08

re: How to give input to a pvcs command automatically?


Quote:

Originally Posted by nirsamp

`vget <program name>` is a PVCS command which gets the program to our home directory. This command is given inside a perl program.

When this command is executed it needs an input to be given in the middle. We need to respond to the below question asked when the command is executed.
Would you like to display milestone label (Y/N)?

Only after we respond to this question the command will execute further. Is there any way that i can give input to this automatically..? say N every time?.

You may give input to the question in the command prompt, even though the question may not get displayed.
But, if you want to set the reply automatically, you may make use of IPC::Run3 module.

-Nithin
Reply