App-DDNS-Namecheap

 view release on metacpan or  search on metacpan

lib/App/DDNS/Namecheap.pm  view on Meta::CPAN

use Moose;
use LWP::Simple qw($ua get);
$ua->agent("");
use Mozilla::CA;

has domain => ( is => 'ro', isa => 'Str', required => 1 );
has password => ( is => 'ro', isa => 'Str', required => 1 );
has hosts => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has ip => ( is => 'ro', isa => 'Str', required => 0 );

sub update {
  my $self = shift;
  foreach ( @{ $self->{hosts} } ) {
    my $url = "https://dynamicdns.park-your-domain.com/update?domain=$self->{domain}&password=$self->{password}&host=$_";
    $url .= "&ip=$self->{ip}" if $self->{ip};
    if ( my $return = get($url) ) {
      unless ( $return =~ /<errcount>0<\/errcount>/is ) {
	$return = ( $return =~ /<responsestring>(.*)<\/responsestring>/is ? $1 : "unknown error" );
        print "failure submitting host \"$_\.$self->{domain}\": $return\n";
	return;
      }

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.604 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )