LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-10-2008, 06:21 AM   #1
anhtt
LQ Newbie
 
Registered: Jul 2007
Posts: 27

Rep: Reputation: 15
Net::Telnet with Perl


I need to telnet to a sunser via 9023 port.
Normally, I can telnet directly as below:
telnet 10.2.4.9 9023
Trying 10.2.4.9...
Connected to 10.2.4.9.
Escape character is '^]'.
900 Login required.
login username passwd
login username passwd
102 2 records.
Lucent NavisRadius Radius Server, Version 4.5.8 (Build 551-060)
Copyright (c) 1998-2005 Lucent Technologies Inc. All Rights Reserved.
==>

I tried to use Net::Telnet with the code following:

#!/usr/bin/perl -w
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,Port => 9023,Prompt => '/==> $/');
$t->open("10.2.4.9");
$t->waitfor("/900 Login required. $/i");
$t->print("login username passwd");


But it's not successful. This is the error message:

missing opening delimiter of match operator in argument "900 Login required.i" given to Net::Telnet::waitfor() at ./try line 5

How can i fix it ?
 
Old 04-10-2008, 08:21 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,689

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Check out this node:

http://www.perlmonks.com/?node_id=156748

I've never used the net::telnet module before, but this may point you in the right direction.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i install net-Telnet Whiteghost Linux - General 1 10-10-2005 10:27 AM
Using Perl NET::TELNET module DannyM Linux - Networking 4 02-15-2005 11:31 AM
Net::Telnet question on perl. mosh Programming 3 08-10-2004 09:43 AM
Help with perl and telnet Miky Programming 2 10-02-2003 04:17 AM
Net::Telnet mrPhantastik Programming 5 09-10-2003 02:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration