G'day IvanAK,
You appear to have taken that code directly from the Net::Telnet documentation. That's fine.
Just before that example code, you'll see:
"... you must also know the user's shell prompt, which for this example is "bash$ " ..."
And just after, you'll see:
"The methods login() and cmd() use the prompt setting in the object to determine when a login or remote command is complete. Those methods will fail with a time-out if you don't set the prompt correctly."
So, check you have the correct prompt.
The problem you've encountered may have nothing to do with an invalid username or password.
| [reply] [d/l] [select] |
What is the switch type?(i.e cisco, etc.)
Can you successfully connect using the os 'telnet' command?
If so what does the conversation look like? | [reply] |
Hi all,
tnx for reply and for help in advance. Im trying to connect on a Dell Switch. Yes i can successfully connect to a switch using CMD ( windows ).
kcott, tnx for reply i thing you are write. But im new to perl and still learning, and i think this is a noob question so dont judge me :) . Just tell me if im on a write path. If im using cmd or if im trying to connect with putty making simple connection from my Windows pc to a Dell switch, i have to tell to my perl program connect using CMD or connect with cmd because that's how you can make successful connection. And what are the other options for the prompt..
| [reply] |
"kcott, tnx for reply i thing you are write. ... And what are the other options for the prompt.."
I've never used Net::Telnet, so I've had to do what you need to do, i.e. Read The Fine Manual.
At the very least, search for prompt.
You'll find all sorts of information, including default value, hints, tips and gotchas.
The author of Net::Telnet appears to have gone to a fair amount of effort to provide the necessary information. However, there does seem to be some expectation regarding a basic knowledge of Perl's regular expressions: if you don't have that, I suggest reading "perlretut - Perl regular expressions tutorial".
"... im new to perl and still learning, and i think this is a noob question so dont judge me :) ..."
I am not judging you.
I never judge someone on the basis of not knowing some particular piece of information: we start off life knowing nothing and we all learn different things.
Until a few hours ago, I didn't know this information either.
Having said that, I note your last question, "Telnet Cisco routers", involved using Net::Telnet::Cisco. The first and third sentences in that documentation are:
"Net::Telnet::Cisco provides additional functionality to Net::Telnet for dealing with Cisco routers."
...
"Before you use Net::Telnet::Cisco, you should have a good understanding of Net::Telnet, so read it's documentation first, and then come back here to see the improvements."
So, perhaps this is something you should have known about.
Finally, I'm not trying to put you off from posting here.
We're happy to help but we do expect you to show some effort yourself: asking for information that's clearly documented does not indicate any such effort.
This is all explained in more detail in "How do I post a question effectively?".
| [reply] |
Tnx for understanding. You are absolutely right. I should read first, but i start learning perl from beginning im reading the book "beginning Perl" :), and im going slow. And all start from the task that was given to me, to telnet more then 600 routers and switches. So my priority is to make this two scripts and parallel with that to learn Perl because i start to love this language :). My perl script for Telnet Cisco it works very well. And for this one i have a problems.
We're happy to help but we do expect you to show some effort yourself: asking for information that's clearly documented does not indicate any such effort. This is all explained in more detail in "How do I post a question effectively?".
Any way You are right, i have to respect the rules and read more in detail. Thanks again for understanding and information you gave me. ;) Ill do my best ;)
| [reply] |