Eradicatore has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to write a perl program on windows that calls a second perl program and then "talks" to that second program. I can start the second program using win32::Process but then how can I do the talking? I assume over a socket on localhost, but I'm not sure how to do that and I've been trying to find more information. Here is what this second program is going to look like for the most part. It's just going to sit there and listen for things from the socket (here just reading from standard in for an example...) and then go get a web page it's told to get.
So you can run this program as is, and if you type in something like "http://www.yahoo.com" and enter it will go get that page and put it in a file. But how would the original program that started this program send it things. Thanks for any help!!#!/usr/local/bin/perl -w use LWP::UserAgent; use URI::URL; my $ua = LWP::UserAgent->new; while($line = <STDIN>) { chomp($line); if ($line =~ /now_done/) { last; } else { $url = $line; $file = 'some_web_page.txt'; my $req = HTTP::Request->new(GET => $url); $req->header('Accept' => 'text/html'); $ua->request($req, $file); } }; print "done now\n"; exit;
Justin Eltoft
"If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re: Win32::Process and Sockets
by tye (Sage) on Sep 25, 2001 at 21:51 UTC | |
Re: Win32::Process and Sockets
by CubicSpline (Friar) on Sep 25, 2001 at 21:40 UTC | |
by Eradicatore (Monk) on Sep 25, 2001 at 22:23 UTC | |
Re: Win32::Process and Sockets
by idnopheq (Chaplain) on Sep 25, 2001 at 22:25 UTC | |
Re: Win32::Process and Sockets
by Rex(Wrecks) (Curate) on Sep 25, 2001 at 22:33 UTC |
Back to
Seekers of Perl Wisdom