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

I am using Net::Telnet to communicate to remote machine. Now after i login to remote machine using Net::Telnet's login method how can i get the prompt that is present? After we login using telent we get a prompt "C:\Document and Setting\<user>\>". How can i get this or what ever other prompt that is opened?
  • Comment on Net::Telent - How to get the prompt displayed after login using telnet?

Replies are listed 'Best First'.
Re: Net::Telent - How to get the prompt displayed after login using telnet?
by regexes (Hermit) on Jul 03, 2007 at 08:20 UTC
    Hello, If I understand your question correctly. You want to see what prompt is being returned?

    Take a look in Net::Telnet see method: last_prompt
    $string = $obj->last_prompt; $prev = $obj->last_prompt($string);
    Sometimes it just easier to set your own prompt. That way you always know what's being returned.
    Look at Net::Telnet --> method: prompt

    $host->login( $username, $password ); my $prompt = "_MYPROMPT_"; $host->prompt("/$prompt\$/"); $host->cmd("prompt = $prompt");


    regexes


    -------------------------
    Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan "press on" has solved and always will solve the problems of the human race.
    -- Calvin Coolidge, 30th President of the USA.