arikamir has asked for the wisdom of the Perl Monks concerning the following question:
and this is how I fork the scriptsub GetStaples { my $oem_PN = $_[0]; my $ItemDesc = $_[1]; my @ItemDesc = split(',',$ItemDesc); my $Item; my $price; my $description; my $type; my $title; my $numofitems; my $agent = WWW::Mechanize->new(autocheck => 1, cooki +e_jar => undef); $agent->get("http://www.staples.com/webapp/wcs/stores +/servlet/home? &langId=-1&storeId=10001&catalogId=10051"); $agent->form_name("headerSearchForm"); $agent->field("searchkey",$oem_PN); $agent->click(); my $stream = HTML::TokeParser->new(\$agent->{content} +); open(OUTFILE, ">>output.html") or die "Can't open out +put.txt: $!"; print OUTFILE $agent->content(); close(OUTFILE); my $tag = $stream->get_tag("title"); $title = $stream->get_trimmed_text("/title"); print "Title:".$tile."\n"; if ($title !~ /that was easy/){...................... +..
the parameters are being passed successfully and if you noticed I've created an outputfile.html to debug the agent- >content and it comes back as expected. even with that I can's get $title back$pidStaples=fork(); die "Cannot fork: $!" if (! de +fined $pidStaples); if (not defined $pidStaples) { print "esources not av +ilable.\n"; } elsif ($pidStaples == 0){ GetStaples($ref->{OEM_ +PartNum},$ref->{Description}); exit(0); }
May 04, 2008 at 17:17 UTC Janitored by McDarren: Added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: weird issue with HTML::TokeParser and Fork
by ikegami (Patriarch) on May 04, 2008 at 06:51 UTC | |
by arikamir (Initiate) on May 05, 2008 at 17:06 UTC | |
by ikegami (Patriarch) on May 05, 2008 at 22:34 UTC | |
by arikamir (Initiate) on May 06, 2008 at 00:43 UTC | |
by ikegami (Patriarch) on May 06, 2008 at 02:27 UTC | |
| |
|
Re: [Click the star to watch this topic] weird issue with HTML::TokeParser and Fork
by Anonymous Monk on May 04, 2008 at 05:28 UTC | |
|
weird issue with HTML::TokeParser and Fork
by BKB (Novice) on May 06, 2008 at 00:39 UTC | |
by arikamir (Initiate) on May 06, 2008 at 00:54 UTC |