title: Displaying a portion of the configuration (--More)
body: <p>I have got this error when i try to connect to my switch !</p>
  <pre><code>use Net::OpenSSH;
  use warnings;
  use Expect;
  
  my $password = 'admin';
  my $enable = '';
  my $ip = '192.16.25.39';
  my $username='user';
  my $ssh = Net::OpenSSH-&gt;new(&quot;$username:$password\@$ip&quot;, timeout =&gt; 200) ;
  $ssh-&gt;error and die &quot;unable to connect to remote host: &quot;. $ssh-&gt;error;
           
  my $output = $ssh-&gt;capture({stdin_data =&gt; &quot;enable\n&quot;.&quot;admin%\n&quot;.&quot;show vlan&quot;.&quot;\n&quot;});
          
  if ($output) {print $output . ' ';}
          
  my $line;
  print &quot;\n&quot;;
          
  # closes the ssh connection
  $ssh-&gt;close();
  </code></pre>
  <p>I have tried this with the Expect module:</p>
  <pre><code>use Net::OpenSSH;
  if ($output) {
      print $output . ' ';
      my $expect = Expect-&gt;init($output);
      $expect-&gt;raw_pty(1);
      #$expect-&gt;debug(2);
      my $debug and $expect-&gt;log_stdout(1);
      while(&lt;$pty&gt;) {
          print &quot;$. $_ &quot;
      }
  }
  </code></pre>
  <p>which produces this error:</p>
  <blockquote>
  <p>Can't bless non-reference value at /usr/local/share/perl5/Expect.pm line 202 (#1) (F) Only hard references may be blessed. This is how Perl &quot;enforces&quot; encapsulation of objects. See perlobj. Uncaught exception from user code: Can't bless non-reference value at /usr/local/share/perl5/Expect.pm line 202. at /usr/local/share/perl5/Expect.pm line 202. Expect::exp_init(&quot;Expect&quot;, &quot;\x{d}\x{a}witch&gt;enable\x{d}\x{a}password:\x{d}\x{a}switch#show vlan\x{d}\x{a}\x{d}\x{a}VLA&quot;...) called at b.pl line 19 &quot;</p>
  </blockquote>