Ask a Question related to PERL Beginners, Design and Development.
-
Ajit P Singh #1
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
-
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... -
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... -
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... -
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... -
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... -
Owen #2
Re: Usage of Net:Telnet
On Fri, 23 Jan 2004 11:45:08 -0000
"Singh, Ajit p" <ajit.pal.singh@thus.net> wrote:
What is the ) doing on line 17?> Timeout => $secs),
> Prompt => 'W9-BAS-01');
--
Owen
Owen Guest
-
Owen #3
Re: Usage of Net:Telnet
On Fri, 23 Jan 2004 13:24:24 -0000
"Singh, Ajit p" <ajit.pal.singh@thus.net> wrote:
Please don't reply to me personally, reply to the list.> 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
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
-
Luinrandir Hernsen #4
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
-
Ricardo Signes #5
Re: Simple Perl code/syntax question
* Luinrandir Hernsen <Luinrandir@silveracorncircle.com> [2004-01-23T09:38:12]
Well, this is a common question. In fact, it's a frequently asked one> 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?
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



Reply With Quote

