in reply to Net::telnet question

One of the first commands you should do is to set PS1 to your own fixed value. That way you know what to expect rather than having to deal with whatever the other side's sending back.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Net::telnet question
by benlaw (Scribe) on Apr 22, 2008 at 13:21 UTC
    yes, but my company has so many restriction on development... so what I can is "adapt" to their environment, but I can't change it.. ~o~(cry)

      You misunderstand; I'm not saying change the default environment, I'm saying send a command to set the transient PS1 in your running shell to something fixed. The default Net::Telnet value of qr/[\$%#>] $/ should be good enough to get you to where you can send something (and if it's not then build on it until it is), then set your fixed prompt as the first command.

      $tel->cmd( "PS1='fixed> '; export PS1" ); $tel->prompt( qr/fixed> $/ );

      That setting is not going to persist past the one process you're talking to, but it allows you to look for a known marker in your sessions (and/or dynamically tweak the prompt if you ever might mistake output data for the prompt).

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.