CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
Opening a process filehandle

 



anaki
New User

Dec 31, 2008, 1:24 PM

Post #1 of 6 (6331 views)
Opening a process filehandle Can't Post

Hello,

I was thinking about writing a Perl script that would run interactive shells, like windows FTP and Telnet. However, I am having difficulty printing to or from the process with the Perl script, and consequently cannot manage the process. Modules I saw online, like IO::Pty and Expect, don't have functionality in Windows Activestate, but do exactly what I am looking for.

IO::React and Net::Telnet look promising in dealing with interactive processes, but rely on a pre-opened handle to the process to do so (unless I am misunderstanding).

If you know of a way to open a handle to an interactive process in Windows Perl, I would love to know about it!

Thank you very much,

anaki


FishMonger
Veteran / Moderator

Dec 31, 2008, 2:01 PM

Post #2 of 6 (6325 views)
Re: [anaki] Opening a process filehandle [In reply to] Can't Post

It sounds like you're wanting:

IPC::Open2
http://search.cpan.org/~nwclark/perl-5.8.9/lib/IPC/Open2.pm

or

IPC::Open3
http://search.cpan.org/~nwclark/perl-5.8.9/lib/IPC/Open3.pm

However, it would be much easier to use
Net::Telnet
Net::FTP


anaki
New User

Dec 31, 2008, 4:42 PM

Post #3 of 6 (6320 views)
Re: [FishMonger] Opening a process filehandle [In reply to] Can't Post

I looked into IPC::Open2 a little, but I admit I didn't put much effort in it.

I was also suggested to try Win32::Socketpair::winopen2(), which returns a filehandle to the process. It looks good so far.

I don't think Net::Telnet creates the filehandle itself, but of course I could be wrong. I may try that out with FHOPEN to interact with the filehandle, though.

Thank you,

anaki


FishMonger
Veteran / Moderator

Dec 31, 2008, 6:36 PM

Post #4 of 6 (6319 views)
Re: [anaki] Opening a process filehandle [In reply to] Can't Post

Net::Telnet and Net::FTP create a socket.

Is there a particular reason you fell you require a filehandle?

BTW, Win32::Socketpair creates a socket.

One of the advantages of using Net::Telnet and Net::FTP (or the underlying IO::Socket which they use), is that your script can be platform independent. If you use a Win32 specific module, then you're locked into using that script only on Windows boxes. I try to avoid that whenever possible.

[edit]
I should make a clarification. Win32::Socketpair::winopen2 creates a socket which is then wrapped in a filehandle.
[/edit]


(This post was edited by FishMonger on Dec 31, 2008, 6:43 PM)


anaki
New User

Dec 31, 2008, 11:38 PM

Post #5 of 6 (6308 views)
Re: [FishMonger] Opening a process filehandle [In reply to] Can't Post

Thank you for your corrections about Net::FTP and Net::Telnet, FishMonger.

I think I need a filehandle, since I would like this interactive process to be managed over an existing socket connection. However, I am of course open to any alternatives.

Thank you again,
anaki


FishMonger
Veteran / Moderator

Jan 1, 2009, 4:54 AM

Post #6 of 6 (6301 views)
Re: [anaki] Opening a process filehandle [In reply to] Can't Post

It would be best if you posted the relevant portion(s) of your code and a specific question on the section that is giving you trouble.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives