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


in reply to Script to Notify of Public IP Change

marto makes a good point about asking the ISP about whether a static or dynamic IP is provided. In the meantime, perhaps something like the following would be helpful:

#!/usr/bin/env perl use strict; use warnings; use LWP::Simple; use Regexp::Common qw/net/; my $ip; for ( 0 .. 9 ) { chomp( $ip = get('http://ip-addr.es/') ); last if defined $ip and $ip =~ /$RE{net}{IPv4}/; sleep 1; } ...

Replies are listed 'Best First'.
Re^2: Script to Notify of Public IP Change
by Arkevius (Initiate) on Nov 29, 2012 at 16:52 UTC
    There seems to be a much faster response time (at least for me) with that address than with the one I currently use. I may very well substitute that bit of code with yours. Thank you for the contribution. I do agree with marto that the best solution would be talk with the ISP. However, in the interest of continuing my experience and learning of Perl, I went with the script, at least for now. I just wanted to clear up the cause of the blank address, which seems to just be an error in parsing the address.