Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Expect.pm control terminal width

by Illuminatus (Curate)
on Oct 07, 2008 at 21:56 UTC ( #715863=note: print w/replies, xml ) Need Help??


in reply to Expect.pm control terminal width

  1. Use Net::SSH::Expect instead. I believe it makes better terminal assumptions
  2. try the 'stty' and/or 'slave' methods in expect.pm: $object->stty(qw("cols 200"));

Replies are listed 'Best First'.
Re^2: Expect.pm control terminal width
by jmclark (Novice) on Oct 07, 2008 at 22:08 UTC
    problem with converting it over to Net::SSH::Expect is that the script is completely done and is around 4k lines of code. It just recently became a problem because of some changes on the devices that have longer outputs so I'd have to competely re-write the script.
    $object->stty(qw("cols 200"));
    Returns:
    IO::Stty::stty passed invalid parameter '"cols'
    IO::Stty::stty passed invalid parameter '200"'
    I also tried columns, no quotes, etc.
      Drop the quotation marks (the ones inside the qw):
      $object->stty(qw(cols 200));
      What you have is passing "cols and 200" to stty, which it does not recognize (as indicated in the error messages). Also note that according to the docs, you probably want to be using the slave side of the pty:
      $object->slave->stty(qw(cols 200));
        Yea, thats what I was saying, I tried without quotes as well.
        Basically below is what I have:
        $acnsex = new Expect(); $acnsex->slave->stty(qw(cols 200)); $acnsex->spawn("ssh -q -o 'UserKnownHostsFile ./output/keys.txt' -o 'S +trictHostKeyChecking no' -l $username $acns"); $acnsex->log_user(0); $acnsex->expect(10, '-re', 'password:');
        Also, looking at stty.pm I don't see that cols is a valid parameter which makes since with that error msg.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://715863]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2018-08-16 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (167 votes). Check out past polls.

    Notices?