On Sunday 23 May 2004 08:25 pm, Ramprasad A Padmanabhan wrote: > I have got a simple script that is straight out of the man page for > Tie::Google. My problem is the script simply hangs. I bet this is > because it is not able to use the environment proxy variables > > I have set my proxy ( requires no auth ) as > export http_proxy=http://myproxy:80 > ( I am using a linux machine .. I dont think that matters ) > > > #!/usr/bin/perl > # > # > use strict; > use Tie::Google; > > my $KEYFILE = glob "~/.googlekey"; > my ($g, @g, %g); > print $ENV{http_proxy}; # works fine > # Tied scalar interface: I Feel Lucky > use LWP::Simple qw(getprint); > tie $g, "Tie::Google", $KEYFILE, "perl"; > getprint($g->{'URL'}); > > > > > This script simply hangs > Any clues ? > Thanks > Ram
Yes, I think you are right Ram, neither Net::Google nor Tie::Google seem to look at the evironment for an http proxy. You can use Net::Google directly and pass it the 'http->proxy => <whatever>' as an option to new, or apply this simple patch to Tie::Google: --- Tie-Google-0.03/Google.pm 2003-04-01 04:48:34.000000000 -1000 +++ Tie-Google-0.03-patched/Google.pm 2004-05-24 00:09:14.310060890 -1000 @@ -105,7 +105,8 @@ $options->{'max_results'} ||= $DEFAULT_BATCH_SIZE; $self->[GOOGLE] = Net::Google->new(key => $self->[KEY], - debug => $options->{'debug'} || 0); + debug => $options->{'debug'} || 0, + http_proxy => $ENV{http_proxy} || ''); # * If called from TIEHASH, then store the results keyed by # search terms, otherwise keyed by $KEY I have tested it on Linux and it works fine (both when http_proxy is in the environment and when not). Darren - would you consider applying something like the above patch to specify http proxies in a future release of Tie::Google ? Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>