Using Net::Telnet, I'm having trouble getting the server I'm connecting
to to recognize my input to the login prompt.  Below is the code so far
(all system/user details have been changed to protect the innocent):


#! /usr/bin/perl
#   tnp -   TelNet via Perl
#   trial program to replace Expect script

use Net::Telnet ();
$ion = new Net::Telnet
(
    -host => "system.name.com",
    -port => 1234,
    -output_record_separator => "\r"
);

$ion->dump_log("ion_log");

$ion->binmode(1);
if ($ion->open())
{
    print "Connected...\n";
}

if ($ion->waitfor(-string => "User ID:"))
{
    print "Saw \"User ID:\" ...\n";
    $ion->print("username");
}

if ($ion->waitfor(-string => "Password:"))
{
    print "Saw \"Password:\" ...\n";
}

$ion->close();

$ion->dump_log;

##### end of program

When I run this, after printing

        Saw "Password:" ...

the connection times out every time.  Looking at ion_log, the last entry
is 
        ... various text and ANSI codes ...
        username

indicating that it was successfully passed to the server.   I have tried
the ->print and ->put calls, with and without various combinations of \r
and \n, with and without binmode() on.  This same functionality
currently exists in a working Expect script (with \r appended to each
input) but I'd like to get it working in Perl as well.

Any ideas on what may be missing will be greatly appreciated.

Joe


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to