#!/usr/bin/perl

use strict;
use warnings;
use Net::Telnet ();

my $port = 4444;
my $username = 'pforty';
my $passwd = 'inttest/';

#print "username ($username), passwd ($passwd)\n";

my $t = new Net::Telnet (Timeout => 5,
                      Port => $port,
                      #Prompt => '/bash\$ $/');
                      #Telnetmode => 0,
                      Prompt => '/pforty\@brana/');

#print "telnet mode - ".$t->telnetmode."\n";

$t->open("localhost");
$t->login($username, $passwd);
my @lines = $t->cmd("who");
print @lines;

exit;

#$t->print("");
#my $line = $t->getline;
#print "line $line";

## Wait for first prompt and "hit return".
#$t->waitfor('/Escape character.*$/');
#$t->print("");

$t->login($username, $passwd);
$t->dump_log();
my $ref = $t->buffer;
print "buffer:\n".\$ref."\n";
$t->cmd("\n");
