Hi all, I'm trying to use Net::Telnet to get the time on a Vax. My code is:
use Net::Telnet; use strict; my($telnet, $timeout, $command, @line); my $name = 'user'; my $passwd = 'password'; my $host = 'host'; $timeout = 900; $telnet = Net::Telnet->new( Prompt => '/prompt\$/', Dump_Log => 'dump.log', Input_Log => 'input.log', Output_Log => "output.log", Host => $host, Timeout => $timeout, ); $telnet->login(Name => $name, Password => $passwd, Prompt => '/prompt\$/' ); @line = $telnet->print('sh time'); $telnet->waitfor('/prompt\$/'); $telnet->print("lo"); #logout $telnet->close;
The returned result is line: 1. From the dump_log (see below), it looks like my command is getting passed, but why am I getting a "1" instead of 1-DEC-2001 01:23:33? It doesn't matter if I put $line = $telnet->print('sh time') - scalar reference, or @line = $telnet->print('sh time') - array reference. I still get a "1". Many thanks.
> 0x00000: 73 68 20 74 69 6d 65 0d 0a sh time.. < 0x00000: 73 68 20 74 69 6d 65 0d 0a sh time.. < 0x00000: 0d 00 20 20 20 31 2d 44 45 43 2d 32 30 30 31 20 .. 1- +DEC-2001 01:23:33.....host$ > 0x00000: 6c 6f 0d 0a lo.. 00000: 6c 6f 0d 0a lo..

In reply to Net:Telnet and Vaxes by maderman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.