in reply to Re^2: trouble with redirecting
in thread trouble with redirecting

So we have to search your program instead of you providing the information. Then, "it doesn't work" is such a lousy description of the problem that the best answer is "well, then make it work."

Is it so difficult to provide basic information? Have you actually read I know what I mean. Why don't you?

What is going wrong? what are the symptoms? Do you get any error message? could you post that?

No, I won't run your code just to find out.

update: GrandFather already gave you the same advice as a reply to your first posting. Why don't you just do it and heed his advice?

Replies are listed 'Best First'.
Re^4: trouble with redirecting
by confused_programmer (Initiate) on Jun 05, 2007 at 18:45 UTC
    i'm new to perl, i have java knowledge and am applying it as best as i can to perl, i have no idea how to get any error messages. what's going wrong i think is the line:
    my $entries = $pua->wait();
    i think that may be the problem, because nothing executes after that. if i input valid links in the requests the program runs fine and just prints out the content of the website. if i input a link that redirects to another link, then my program freezes up. thats about as best as i can describe my problem. like i said this code isn't fully mine, and im having trouble understanding it
      what's going wrong i think is the line:
      my $entries = $pua->wait();

      You could have posted that bunch of information in the first place; now we can talk and I can stop gruntling, thank you.

      Did you read the documentation for LWP::Parallel::UserAgent? From there...

      ... $ua->wait ( $timeout ); ...

      DESCRIPTION

      This class implements a user agent that access web sources in parallel.

      Using a LWP::Parallel::UserAgent as your user agent, you typically start by registering your requests, along with how you want the Agent to process the incoming results (see $ua->register).

      Then you wait for the results by calling $ua->wait. This method only returns, if all requests have returned an answer, or the Agent timed out. Also, individual callback functions might indicate that the Agent should stop waiting for requests and return. (see $ua->register)

      So start with setting a timeout calling wait - no, wait, start reading the doc. It might help:

      $ua->register ( $request [, $arg [, $size [, $redirect_ok]]] )
      Registers the given request with the User Agent. In case of an error, a "HTTP::Request" object containing the HTML-Error message is returned. Otherwise (that is, in case of a success) it will return undef.

      The $request should be a reference to a "HTTP::Request" object with values defined for at least the method() and url() attributes.

      $size specifies the number of bytes Parallel::UserAgent should try to read each time some new data arrives. Setting it to '0' or 'undef' will make Parallel::UserAgent use the default. (8k)

      Specifying $redirect_ok will alter the redirection behaviour for this particular request only. '1' or any other true value will force Parallel::UserAgent to follow redirects, even if the default is set to 'no_redirect'. (see "$ua-"redirect>) '0' or any other false value should do the reverse. See LWP::UserAgent for using an object's "requests_redirectable" list for fine-tuning this behavior.

      Hope that helps to get you started.

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}