All the module allows you to do is open up a telnet session and interact
with it.  So yes, you can store the return value of a command into a
variable like this:

my $host = $t->cmd(String => 'hostname', Prompt => '/\$ $/')

I'm not sure what you mean by sending/read data at the sime time.  I am
thinking that you can't do that, at least not the way you want.  You could
always open up two telnet sessions if you needed to, but you would need to
have two seperate processes (fork) and then have the processes talk to one
another.

Rob


-----Original Message-----
From: Agustin Rivera [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 4:15 PM
To: Hanson, Robert; 'Oktay Ahmed'; [EMAIL PROTECTED]
Subject: Re: SEND


Is there a way with Net::Telnet that I can read data and send data
simultaneously?  Or how about capturing the data that comes in to a
variable?

Agustin Rivera
Webmaster, Pollstar.com
http://www.pollstar.com



----- Original Message -----
From: "Hanson, Robert" <[EMAIL PROTECTED]>
To: "'Oktay Ahmed'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, January 16, 2002 1:12 PM
Subject: RE: SEND


> You can't send data through an open Telnet session if that is what you are
> thinking. (disclaimer: maybe you can, but good luck trying to do that).
> What you want is to use the Net::Telnet module.
>
> use Net::Telnet;
>
> # Open a telnet session
> my $t = new Net::Telnet (Timeout => 10);
> $t->open("1.2.3.4");
>
> # Login
> $t->login($username, $passwd);
>
> # Execute the command 'ls' (or whatever you need) when you see the prompt
'$
> '
> $t->cmd(String => 'ls', Prompt => '/\$ $/');
>
> # Close the connection
> $t->close;
>
> Or are you just trying to upload data?  Anyway, check out the Net::Telnet
> docs, it might do exactly what you need.
>
> Rob
>
>
> -----Original Message-----
> From: Oktay Ahmed [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 17, 2002 12:48 AM
> To: [EMAIL PROTECTED]
> Subject: SEND
>
>
> Hi
>
> Ý am a very beginner in Perl. Here is my problem:
>
> I want to send some data on (via) established connection (telnet). I don't
> need any code to establish connection, to login, etc. I just need to send
> data (including "\n" at the end). How to do this?
>
> What modules I have to use?
>
> Sorry for asking this kind of simple questions...
>
> Best,
> Oktay
>
> -----
> Oktay AHMED, MA, Chairman
> MENSA MACEDONIA, The High-IQ Society
> P.O.Box 747, 1000 Skopje, Macedonia
> E-mail: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> Web: <www.mensa.org.mk>
> Fax: +1 305 574 0549 (USA) /  +44 870 136 3517 (UK)
> -----
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to