in reply to Flickr::API and using a proxy

instead of explicitly creating a separate LWP::UserAgent object, have you tried setting the proxy directly in the Flickr::API object like so?

$api->proxy('http', 'http://wwwcache.aber.ac.uk:8080//');

Replies are listed 'Best First'.
Re^2: Flickr::API and using a proxy
by pemungkah (Priest) on Dec 09, 2006 at 01:47 UTC
    Exactly! The LWP object ($ua) had the proxy set, and then the code creates a completely different object in $api.

    This is why setting the proxy on $api works: Flickr::API is a subclass of LWP::UserAgent - so any method that LWP::UserAgent has, Flickr::API has (subject to Flickr::API overriding said method).

    To speak metaphorically, if LWP ::UserAgent was a quart of milk, and Flickr::API a quart of chocolate milk, you poured a glass of milk ($ua = LWP::UserAgent->new) and a glass of chocolate milk ($api = Flickr::API->new()), put a straw in the glass of milk (setting up the proxy on $ua), and then couldn't drink the chocolate milk because it didn't have a straw in it (you needed to call the proxy() method on $api).

Re^2: Flickr::API and using a proxy
by zmerlinz (Novice) on Dec 08, 2006 at 16:37 UTC
    ah it make sense now :) because Flickr::API is a subclass of LWP::UserAgent, i can use the same switches, in this case proxy. Works a treat now thank you :)