Connecting Tech Pros Worldwide Help | Site Map

How to give input to a pvcs command automatically?

  #1  
Old October 26th, 2008, 04:41 PM
Newbie
 
Join Date: Sep 2008
Posts: 6
`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?.
  #2  
Old October 26th, 2008, 06:05 PM
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,543

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
  #3  
Old October 26th, 2008, 06:33 PM
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,097

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
  #4  
Old October 29th, 2008, 10:29 AM
Newbie
 
Join Date: Sep 2008
Posts: 6

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?.
  #5  
Old October 29th, 2008, 02:08 PM
nithinpes's Avatar
Expert
 
Join Date: Dec 2007
Posts: 400
Provided Answers: 1

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