line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::LivedoorDomain::DDNS::Response; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
5
|
2
|
|
|
2
|
|
9
|
use base qw/Class::Accessor/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
2690
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/result_code ip user hostname message/); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
|
|
|
|
|
|
my ($class, $res) = @_; |
11
|
|
|
|
|
|
|
my $self = bless {}, $class; |
12
|
|
|
|
|
|
|
$self->_init($res); |
13
|
|
|
|
|
|
|
$self; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub is_success { |
17
|
|
|
|
|
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
return $self->result_code eq '200'; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _init { |
22
|
|
|
|
|
|
|
my ($self, $res) = @_; |
23
|
|
|
|
|
|
|
return unless $res->code =~ m/^(2|3)/; |
24
|
|
|
|
|
|
|
my $content = $res->content; |
25
|
|
|
|
|
|
|
return unless $content =~ m/\n(.*)<\/PRE>/s; |
26
|
|
|
|
|
|
|
$content = $1; |
27
|
|
|
|
|
|
|
my @lines = split m/\n/, $content; |
28
|
|
|
|
|
|
|
my %data; |
29
|
|
|
|
|
|
|
for my $line(@lines) { |
30
|
|
|
|
|
|
|
my ($key, $val) = split m/\:\s*/, $line; |
31
|
|
|
|
|
|
|
$key = lc($key); |
32
|
|
|
|
|
|
|
$self->$key($val); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
__END__ |