line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::DDNS::Namecheap; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$App::DDNS::Namecheap::VERSION = '0.014'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
24912
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use LWP::Simple qw($ua get); |
8
|
|
|
|
|
|
|
$ua->agent(""); |
9
|
|
|
|
|
|
|
use Mozilla::CA; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has domain => ( is => 'ro', isa => 'Str', required => 1 ); |
12
|
|
|
|
|
|
|
has password => ( is => 'ro', isa => 'Str', required => 1 ); |
13
|
|
|
|
|
|
|
has hosts => ( is => 'ro', isa => 'ArrayRef', required => 1 ); |
14
|
|
|
|
|
|
|
has ip => ( is => 'ro', isa => 'Str', required => 0 ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub update { |
17
|
|
|
|
|
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
foreach ( @{ $self->{hosts} } ) { |
19
|
|
|
|
|
|
|
my $url = "https://dynamicdns.park-your-domain.com/update?domain=$self->{domain}&password=$self->{password}&host=$_"; |
20
|
|
|
|
|
|
|
$url .= "&ip=$self->{ip}" if $self->{ip}; |
21
|
|
|
|
|
|
|
if ( my $return = get($url) ) { |
22
|
|
|
|
|
|
|
unless ( $return =~ /<errcount>0<\/errcount>/is ) { |
23
|
|
|
|
|
|
|
$return = ( $return =~ /<responsestring>(.*)<\/responsestring>/is ? $1 : "unknown error" ); |
24
|
|
|
|
|
|
|
print "failure submitting host \"$_\.$self->{domain}\": $return\n"; |
25
|
|
|
|
|
|
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
no Moose; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
App::DDNS::Namecheap - Dynamic DNS update utility for Namecheap registered domains |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 VERSION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
version 0.014 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $domain = App::DDNS::Namecheap->new( |
48
|
|
|
|
|
|
|
domain => 'mysite.org', |
49
|
|
|
|
|
|
|
password => 'abcdefghijklmnopqrstuvwxyz012345', |
50
|
|
|
|
|
|
|
hosts => [ "@", "www", "*" ], |
51
|
|
|
|
|
|
|
ip => '127.0.0.1', #optional -- defaults to external ip |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$domain->update(); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This module provides a method for setting the address records of your Namecheap hosted |
59
|
|
|
|
|
|
|
domains. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 METHODS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=over 4 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item B<update> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Updates Namecheap A records using the attributes listed above. The optional ip attribute |
68
|
|
|
|
|
|
|
can be set statically; otherwise the ip where the script is running will be used. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
David Watson <dwatson@cpan.org> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SEE ALSO |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
scripts/ in the distribution |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify |
83
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |