> Is there an easy way to pipe output to an external perl routine and then > pipe the output of that routine back in for more processing? > > In particular I want to use LWP::UserAgent to grab a web page, pipe the > output to Tom Christiansen's "striphtml" routine > (http://www.cpan.org/authors/Tom_Christiansen/scripts/striphtml.gz) and then > pipe that output back in for some subsequent processing. Something like: > > my $ua = new LWP::UserAgent; > my $request = new HTTP::Request('GET', $myURL); > my $response = $ua->request($request); > my $page = $response->content; > > open(STRIPHTML, "|striphtml.pl") || die("Can\'t open striphtml: $!\n"); > print STRIPHTML $page; > close(STRIPHTML); # maybe not such a good idea? > > This works fine so far... But now what? How do I get the output of > striphtml.pl back in to do some more processing on it? > > I know I can do this with a temporary file, but I loathe using them when > reasonable alternatives might be available... > > Thanks! > -Dan >
Check out IPC::Open3 and IPC::Open2, perldoc IPC::Open3 perldoc perlopentut Haven't looked at striphtml but I suspect this could be done with a module inside of the main source rather than shelling out to another program. Or by pulling in the program as a lib and calling its code directly?? http://danconia.org > --- > Dan Fish - [EMAIL PROTECTED] > "A -good- dive buddy will be there if you run out of air, a -great- one will > be there before you run out!" > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>