« DRI/Protocol/EPP/Extensions/DNSBE/Contact.pm
↑ Summary
DRI/Protocol/EPP/Extensions/VeriSign/WhoisInfo.pm »
| 1 | ## Domain Registry Interface, DAS Message | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2007-2010,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ## (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | package Net::DRI::Protocol::DAS::Message; | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Net::DRI::Protocol::ResultStatus; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use base qw(Class::Accessor::Chained::Fast Net::DRI::Protocol::Message); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | __PACKAGE__->mk_accessors(qw(version errcode errmsg errlang command command_param cltrid response)); | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | Net::DRI::Protocol::DAS::Message - DAS Message for Net::DRI | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | Please see the README file for details. | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | Copyright (c) 2007-2010,2013 Patrick Mevzek <netdri@dotandco.com>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | my ($class,$trid)=@_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $self={ | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | errcode => -1000, | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | response => {}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | bless($self,$class); | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | $self->cltrid($trid) if (defined($trid) && $trid); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $trid and $trid
MC/DC0%0/2
defined $trid and $trid
defined $trid
$trid
Truth table0%0/3
A and B
A= defined $tridB= $trid
| |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub is_success { return (shift->errcode()==0)? 1 : 0; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_success: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | sub result_status | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_status: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ## From http://www.dns.be/en/home.php?n=317 | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ## See also http://www.dns.be/en/home.php?n=44 | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my %C=( 0 => 1500, ## Command successful + connection closed | |||||||||||||||||||||||||||||||||||||||||||||
| 89 | -9 => 2201, ## IP address blocked => Authorization error | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | -8 => 2400, ## Timeout => Command failed | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | -7 => 2005, ## Invalid pattern => Parameter value syntax error | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | -6 => 2005, ## Invalid version => Parameter value syntax error | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my $c=$self->errcode(); | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | my $rs=Net::DRI::Protocol::ResultStatus->new('das',$c,exists $C{$c} ? $C{$c} : 'COMMAND_FAILED',$self->is_success(),$self->errmsg(),$self->errlang(),undef); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $rs->_set_trid([ $self->cltrid(),undef ]); | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return $rs; | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | sub as_string | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | my ($self)=@_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $s=sprintf("%s %s %s\x0d\x0a",$self->command(),$self->version(),$self->command_param()); | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | return $s; | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||
| 107 | sub parse | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | my ($self,$dc,$rinfo)=@_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my @d=$dc->as_array(); | |||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $rc; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my @tmp=grep { /^%% RC\s*=\s*\S+/ } @d; | |||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if (@tmp) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ($rc)=($tmp[0]=~m/^%% RC\s*=\s*(\S+)\s*$/); | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $self->errcode($rc); | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ((defined $rc && $rc==0) || grep { /^Status: /} @d) ## success | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $rc and $rc == 0 or grep {/^Status: /;} @d
defined $rc and $rc == 0
MC/DC0%0/3
defined $rc and $rc == 0 or grep {/^Status: /;} @d
defined $rc
$rc == 0
grep {/^Status: /;} @d
Truth table0%0/5
A and B or C
A= defined $rcB= $rc == 0C= grep {/^Status: /;} @d
| |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $self->errcode(0); | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my %info=map { m/^(\S+):\s+(.*\S)\s*$/; $1 => $2 } grep { /^\S+: / } @d; | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | Net::DRI::Exception->die(0,'protocol/DAS',1,'Unsuccessfull parse, missing key Domain') unless exists $info{Domain}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | Net::DRI::Exception->die(0,'protocol/DAS',1,'Unsuccessfull parse, missing key Status') unless exists $info{Status}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $self->response(\%info); | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | } else | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $self->errlang('en'); ## really ? | |||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my ($msg)=($d[-1]=~m/^%\s*(\S.+\S)\s*$/); | |||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $self->errmsg($msg); | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | #################################################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||