weird issue with HTML::TokeParser and Fork

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I wrote a script that scrape information off and I'm
getting different results if I run it stand alone or I fork the
running the script stand alone I get the expected results and when
forking the script it seems like it ignores the <title> tag. any help
is appreciated:
this is part of the script:
sub 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, cookie_jar =>

         $agent->get(" ?
         my $stream = HTML::TokeParser->new($agent->);

         open(OUTFILE, ">>output.html") or die "Can't open output.txt: $!";
         print OUTFILE $agent->content();
         my $tag = $stream->get_tag("title");
         $title = $stream->get_trimmed_text("/title");
         print "Title:".$tile."\n";
         if ($title !~ /that was easy/){........................

and this is how I fork the script

                    die "Cannot fork: $!" if (! defined $pidStaples);
                    if (not defined $pidStaples) {
                        print "esources not avilable.\n";
                    } elsif ($pidStaples == 0){

the parameters are being passed successfully
and if you noticed  I've created an outputfile.html to debug the agent-
Quoted text here. Click to load it
even with that I can's get $title back

Re: weird issue with HTML::TokeParser and Fork

Ben Bullock wrote:

Quoted text here. Click to load it

This guy posted the exact same question on Perlmonks, and,
unsurprisingly, got the exact same reply (second rekly, by ikegami).

I hate it when people are multiposting the same question all over, and
are simply not paying attention to the replies.


Site Timeline