http://www.perlmonks.org?node_id=701358


in reply to How to define a package using a tweaked version of LWP::UserAgent?

This might sound inelegant, but what I've done in the past is inject a subroutine into the LWP::UserAgent package that occludes the original get_basic_credentials(). I define this routine either to supply the credentials directly, or make it a closure so I can use it to install a callback.

I know its probably pretty far from best practice. I also think having to subclass the useragent to supply credentials is a bit naff.

  • Comment on Re: How to define a package using a tweaked version of LWP::UserAgent?

Replies are listed 'Best First'.
Re^2: How to define a package using a tweaked version of LWP::UserAgent?
by pwolfenden (Novice) on Jul 31, 2008 at 14:46 UTC

    How exactly did you "inject" the subroutine? I'd love to see an example where you make it a closure and then install a callback method.

    Thanks!