Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default RE: Usage of Net:Telnet


    Hello Friends,

    I am trying to get the prompt parameter right for my Telnet connection.
    Doesnt seem to be working...

    can somebody help me out with this ...

    The prompt from my remote host(cisco box) is as shown below:

    W9-BAS-01>

    $t = new Net::Telnet (Timeout => 10,
    Input_log => $inlogfileg,
    Output_log => $outlogfile,
    Telnetmode => 1,
    dump_log => $dmplog,
    Timeout => $secs),
    Prompt => 'W9-BAS-01');


    Error message:

    syntax error at Bastelnet.pl line 18, near "'W9-BAS-01')"
    Execution of Bastelnet.pl aborted due to compilation errors.


    ----------------------------------------------------------------------------
    ----------------

    regards,

    Ajitpal Singh,
    Ajit P Singh Guest

  2. Similar Questions and Discussions

    1. How do you telnet from 1 host to another using Telnet Module
      Hello, I need to know how you telnet from one host to another using the net::telnet module. I can telnet to a single host OK but I need to then...
    2. net::telnet to ms telnet server
      i need to connect to a microsoft telnet server via net::telnet (and io::pty). i can connect and communicate successfully via the telnet command in...
    3. TCP/IP - Telnet in MX 6.1
      I am using ColdFusion 6.1. The project I am working on requires ColdFusion to connect to a terminal server or an ip addressable switch. The command...
    4. Net::Telnet problem with MS Telnet Service
      Hello, After reading the Net::Telnet documentation, examples, searching the 'Net, etc., I still do not completely understand the problem of...
    5. usage of Net::Telnet
      Hi , I am trying to use the Net::Telnet module after installing in my solaris 2.8 machine. But I am unable to get the output. There is no...
  3. #2

    Default Re: Usage of Net:Telnet

    On Fri, 23 Jan 2004 11:45:08 -0000
    "Singh, Ajit p" <ajit.pal.singh@thus.net> wrote:
    > Timeout => $secs),
    > Prompt => 'W9-BAS-01');
    What is the ) doing on line 17?

    --
    Owen

    Owen Guest

  4. #3

    Default Re: Usage of Net:Telnet

    On Fri, 23 Jan 2004 13:24:24 -0000
    "Singh, Ajit p" <ajit.pal.singh@thus.net> wrote:
    > Thanks Owen for your reply.
    >
    > that was a typo, however i m getting the below error message now..
    >
    > $t = new Net::Telnet (Timeout => 10,
    > Input_log => $inlogfileg,
    > Output_log => $outlogfile,
    > Telnetmode => 1,
    > dump_log => $dmplog,
    > Timeout => $secs,
    > Prompt => 'W9-BAS-01');
    > # Prompt => '/bash\$ $/');
    > $t->open("hostname");
    >
    > Error message:
    > ignoring bad Prompt argument "W9-BAS-01": missing opening delimiter of match
    > operator at Bastelnet.pl line 12
    Please don't reply to me personally, reply to the list.

    Try something like this

    my $t = Net::Telnet->new(Host=>"hostname",
    Timeout=>$secs;
    Dump_log=>$dump_log); # assign $dump_log

    $t->waitfor('/W9-BAS-01/') || die "bad $1";
    $t->print ("$whatever");


    Read perdoc Net::Telnet

    Read the dumplog, it often contains clues as to what is happening




    --
    Owen

    Owen Guest

  5. #4

    Default Simple Perl code/syntax question

    Hallo everyone and thank you for your previous help

    in basic the code would be

    for x=1 to 100
    Select Case
    Case=10,20,30,40,50,60,70,80,90
    then do this
    else
    else do this
    end select
    next x

    how is this done in perl?

    foreach (10,20,30,40,50,60,70,80,90);
    {
    do this;
    }

    ???? I think I need to unpack my books! (i'm moving)LOL
    Lou
    Luinrandir Hernsen Guest

  6. #5

    Default Re: Simple Perl code/syntax question

    * Luinrandir Hernsen <Luinrandir@silveracorncircle.com> [2004-01-23T09:38:12]
    > Hallo everyone and thank you for your previous help
    >
    > in basic the code would be
    > Select Case
    > ...
    > end select
    >
    > how is this done in perl?
    Well, this is a common question. In fact, it's a frequently asked one
    with an entry in the perlfaq. This kind of construct is called, in many
    languages, a switch. You can see the FAQ's answer by running "perldoc
    -q switch" or by looking for the switch/case question in perlfaq7.

    Your example was specific, so I can give a specific answer or two:

    for (1 .. 100) {
    unless ($_ % 10) {
    print "divisible by ten\n";
    }
    }

    That's about what you said, right? For every number from 1 to 100, do
    something at the ten's. Of course, someone more familiar with C (or
    with the syntax of 'for') might say:

    for (my $i = 1; $i <= 100; $i+=10) {
    print "$i is divisible by ten!\n";
    }

    This skips a condition, incrementing $i by ten every time.

    See, Perl was designed knowing that there are a whole lot of ways to use
    a switch, and a whole lot of ways one might implement it specifically.
    So, rather than canonize one, a single "switch" statement is left out.
    The best thing to do is figure out how to solve the problem the best
    way.

    There does exist a module called Switch that will give you a switch/case
    statement, but it's not really for production use. It's a neat idea,
    but isn't ready for prime time.

    Does that answer your question?

    --
    rjbs

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.1 (GNU/Linux)

    iD8DBQFAET7D5IEwYcR13KMRAqisAKCKoWHVYd3afw4iGwj8t7 1GUBjtiQCfe/7r
    ZUg9VpEVvOSuzV0zLEKfZ8c=
    =LVwa
    -----END PGP SIGNATURE-----

    Ricardo Signes Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139