Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Net::Telnet different prompts

by emcek (Initiate)
on Jun 12, 2013 at 09:52 UTC ( #1038421=perlquestion: print w/replies, xml ) Need Help??

emcek has asked for the wisdom of the Perl Monks concerning the following question:


Of course I need write some Telnet code in perl but i have some problems. My system support diffrent types of prompt with different functionality, so:

1. login prompt:

This computer resource is private property. Unauthorized access, misuse, and misappropriation of resources is prohibited by law. hapWibbSc2 login: root Password: Last login: Tue Jun 11 12:04:37 on ttyS0 root@hapWibbSc2:~#

2. 'linux' kind prompt root@hapWibbSc2:~#

3. agent prompt:

root@hapWibbSc2:~# cli Starting Agent CLI hapWibbSc2#

How to detect in which prompt am I, because there is different types of command in every.

And second problem when I grabbing out put of command sometime if output is longer it print "--More--" waiting for <space> key from user to print rest how to decect is and send <space> and grab rest of output.


...pciConflictResolutionMode preview sendSortedEutraNeighbors true sen +dSortedCdma2000Neighbors true TinterFreqAnrMeasDuration 100 TreportStrongestCellsForSonEhrpd 1 +00 TreportStrongestCellsForSonOnex 100 sonAppLogEn able true anrModeEUtran disabled anrModeEhrpd disabled anrModeOnex dis +abled nrtMaxSizeEUtran 134 nrtMaxSizeEhrpd 134 nrt MaxSizeOnex 134 anrScoreOnexMin 5 anrScoreOnexMax 10 anrSco --More-- reOnexThresholdMax 20

Anyhelp will be grate!

Replies are listed 'Best First'.
Re: Net::Telnet different prompts
by Anneq (Vicar) on Jun 12, 2013 at 11:21 UTC

    Maybe you can use shell commands to change the prompt to what your script expects.

    For your second problem, if you tell us what command you are using that issues the --more-- prompt, perhaps someone could help you with that command, to ensure that it doesn't happen.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1038421]
Approved by Happy-the-monk
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2020-07-09 13:59 GMT
Find Nodes?
    Voting Booth?

    No recent polls found