Hello. I am using Net:Telnet to connect to a remote application. I am able to connect to the application without any problems. The application prompts for an output file path, and if the file already exists, it sends the prompt "The file exists... Do you want to overwrite it?". I would like to conditionally respond to this prompt when it appears. So far I have tried:
$fexists = $t->waitfor(String => '/The file exists\.\.\. Do you want t +o overwrite it?/', errmode => 'return', timeout => 2); if ($fexists == 1) { t->print("Y");
Setting the error mode to return works if the file doesn't exist and it does nothing (expected). If the file does exist, I thought from reading the manual on Net::Telnet that waitfor would return a 1 if successful, but the code does not work. I have tried printing the value of $fexists, and it is null in both cases (if the file exists or not). Any ideas? Thank you
In reply to Using Conditionals with Net::Telnet by MKJ747
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |