diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-01-31 21:55:50 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-01-31 21:55:50 +0100 |
commit | 1b23db3d002e2519140d59645b5388652fa204bb (patch) | |
tree | 125171dea374d3226e093f217bfa2da99386c13d /bin | |
parent | 7c869ec04330f2f07c571b1fec8c14273d754ea6 (diff) |
vnet: Switch to LWP::UserAgent to ignore proxy settings (I want _my_ IP)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/vnet | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -11,7 +11,7 @@ use autodie; use GD; use Getopt::Std; use Term::ANSIColor; -use LWP::Simple; +use LWP::UserAgent; my %opts; my $alpha; @@ -19,10 +19,19 @@ my $share = $0; my ($ext_ip, $int_ip); sub get_ext_ip { - my $ext = get('http://derf.homelinux.org/cgi-bin/clientinfo/ip.cgi') - // qq{?} ; - chomp $ext; - return $ext; + my $ua = LWP::UserAgent->new( + env_proxy => 0 + ); + my $re = $ua->get('http://derf.homelinux.org/cgi-bin/clientinfo/ip.cgi'); + + if ($re->is_success()) { + my $text = $re->decoded_content(); + chomp $text; + return $text; + } + else { + return qq{?}; + } } sub get_int_ip { |