in reply to Re: Forcing LWP-UserAgent to use a proxy server without modifying code
in thread Forcing LWP-UserAgent to use a proxy server without modifying code

I successfully modified the source to LWP/UserAgent as you suggested. Line 98 of the version of UserAgent.pm that I have calls the env_proxy method if the correct parameter has been passed to it. I simply modified it so it always calls the method. Thanks!
  • Comment on Re^2: Forcing LWP-UserAgent to use a proxy server without modifying code

Replies are listed 'Best First'.
Re^3: Forcing LWP-UserAgent to use a proxy server without modifying code
by Old_Gray_Bear (Bishop) on Jan 04, 2008 at 19:24 UTC
    Umph. And the next time you get a New version of LWP from CPAN? What happens to your change on line 98, then?

    Hand-editing CPAN modules is a chancy proposition at best. You are setting yourself up to strange bugs in the future; and, what have you just done to the other folks using LWP::UserAgent? Suddenly their code breaks because they aren't using a proxy...? Also, is this code going to be run on other machines? Are you going to make the change to line 98 everywhere? Sigh.

    I'd strongly suggest that you rethink this policy. Make a local copy of LWP::UA in your ~home directory and edit *that* if you have absolutely to. Changing the universal copy of a CPAN module -- this is just Not A Good Idea.

    ----
    I Go Back to Sleep, Now.

    OGB

      Sure, LWP::Simple is nice and easy, and gets the job done, but there's been many cases where I've had to change to the regular LWP, just because ::Simple is, well, too simple...

      Take the plunge - move onto LWP.. It's a lot more flexible...