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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: problem in connecting remote host
by andyford (Curate) on Dec 07, 2006 at 14:51 UTC
    It would help a great deal if you posted the exact error you get.

    I put in a print statement after the variable assignment to $prompt,

    print "$prompt\n";
    and got this result:
    ash-2.03\\
    Hence, I think you need to change your strategy on the second line.

    Also, (guessing here) I don't think you want to set that prompt in the "new Net::Telnet" object creation. You should just leave that out if you're going to use the explicit open & waitfor strategy.

    non-Perl: Andy Ford

Re: problem in connecting remote host
by themage (Friar) on Dec 07, 2006 at 14:59 UTC
    Hi,

    The basic question would be: What's working, and what is not?

    Obvious things you should change:

    • $prompt='bash-2.03'
    • add $telnet->dump_log('/tmp/telnet.log');, before the $telnet->open(...); and see what is really happening in the telnet session.
    We can give you lots of ideas, but to help you out may be needed that you explain us better what your problem is.

    TheMage
    Talking Web
Re: problem in connecting remote host
by perladdict (Chaplain) on Dec 07, 2006 at 15:33 UTC
    define the prompt as
    $prompt = 'bash-2.03\#
    print $prompt;
    it will prints the exact prompt which u want to match in that variable
    one more error u have to correct by giving space after '/login: $/i'
    as well as '/paswd: $/',after these changes script will works fine