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.
#!/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;
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!!

Justin Eltoft

"If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews


In reply to Win32::Process and Sockets by Eradicatore

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.