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.