Hi
I run Perl (Using QTP), creating a Telnet object and logging in.
On some PCs it's OK, but on some I get a response:
login failed: filehandle isn't open
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
Hi Travs69
It runs on some PCs so doesn't seem that code is the problem.
This is the code:
use strict;
use Net::Telnet;
use File:ath;
#use warnings;
my $Server=$ARGV[0];
my $username=$ARGV[1];
my $password=$ARGV[2];
my $sCommand=$ARGV[3] . ";echo Auto_Done";
my $expectedprompt=$ARGV[4];
my $timeoutforsync=$ARGV[5];
my $t = new Net::Telnet (Timeout => 30,Port=>23,Host=>$Server,Errmode=>'return');
my %cmdArr=("Name"=>$username, "Password"=>$password, "Prompt"=>"/>/", "Timeout"=>$timeoutforsync, Errmode=>'return');
my $ok=$t->login(%cmdArr);
my $msg = $t->errmsg;
if($msg ne "")
{
open (my $fh,">",$FILE_NAME) or die "could not open '$FILE_NAME'\n";
print $fh ("UNIX ERROR\n");
print $fh ("Message returned from UNIX: \n");
print $fh ("$msg");
my $t = new Net::Telnet (Timeout => 30,Port=>23,Host=>$Server,Errmode=>'return') || die "Could not connecto to $Server:$!\n";
and
my $ok=$t->login(%cmdArr) || die "Could not login into $Server:$!\n";
and see if that gets you a little closer to your problem.
Is there a reason you are surrounding all your print statements with ()?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
Let me know if you get some different error message though. It would be intersting to see what is going on.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.