[olug] perl cgi browser based telnet
Ryan O'Rourke
ryano at ch-gifts.com
Fri Jan 23 20:03:36 UTC 2004
I'm working on implementing a browser based telnet application for use
on our LAN.
I found some Perl code to be dropped into the Apache cgi-bin and gave it
a shot, but I keep getting "500: Internal Server Error"
The httpd error log states:
Can't locate Net/Telnet.pm in @INC [error log snipped here for brevity]
BEGIN failed--compilation aborted at /usr/local/apache/cgi-bin/telnet.pl
line 3.
[Fri Jan 23 13:27:43 2004] [error] [client 10.1.10.15] Premature end of
script headers: /usr/local/apache/cgi-bin/telnet.pl
'hello_world.pl' works from cgi-bin and 'telnet.pl' is chmod 755.
Can someone help point me in the right direction? Thank you.
-- Ryan
The code is as follows :
------- Begin 'telnet.pl' -------
#!/usr/bin/perl
use Net::Telnet;
$HOST = 'servername.hostnane.com';
print "Enter the username for the $HOST account: ";
$username = <STDIN>;
chomp $username;
print "Enter the password for the $HOST account: ";
system('stty -echo');
$password = <STDIN>;
system('stty echo');
chomp $password;
$telnetobj = new Net::Telnet(Timeout=>10,Prompt=>'/elmo \$ $/',
Errmode =>'die');
print "\nAbout to connect...\n";
$telnetobj->open($HOST);
print "Connected!\n";
print "Trying to log in...\n";
$telnetobj->login($username, $password);
print "Logged in!\n";
@fingeroutput = $telnetobj->cmd('finger');
print "Logged in!\n";
@fingeroutput = $telnetobj->cmd('finger');
print @fingeroutput;
$telnetobj->close();
More information about the OLUG
mailing list