Dan Fish wrote:
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...
Copy and paste Tom's code into your program.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>