DRI/Protocol/DAS/AdamsNames/Message.pm

filter: Statementstmt 40.4% 17 / 42 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 5 / 10 Podpod 20.0% 1 / 5 totaltotal 30.6% 23 / 75 CC 7 SCAR 21.5
CC
7
Cov
30%
new
20.0
parse
12.0
is_success
6.0
CRAP 8.6
« DRI/Protocol/OpenSRS/XCP/Account.pm ↑ Summary DRI/Cache.pm »
1 ## Domain Registry Interface, AdamsNames DAS Message
2 ##
3 ## Copyright (c) 2009,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::AdamsNames::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 command_param cltrid response));
25  
26 =pod
27  
28 =head1 NAME
29  
30 Net::DRI::Protocol::DAS::AdamsNames::Message - AdamsNames 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) 2009,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 $proto=shift;
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
71 0 ▶ my $class=ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
72 0 my $trid=shift;
73  
74 0 my $self={
75 errcode => -1000,
76 response => {},
77 };
78  
79 0 bless($self,$class);
80 0 ▶ $self->cltrid($trid) if (defined($trid) && $trid);
Branch: 1 branch
BranchTrueFalseTotal
if defined $trid and $trid 0 0 0
Condition0%0/3
defined $trid and $trid
!ll&&!rl&&r
000
MC/DC0%0/2
defined $trid and $trid
defined $trid $trid
Truth table0%0/3
A and B
A= defined $tridB= $trid
ABresult
0X0
100
111
81 0 return $self;
82 }
83  
84 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
BranchTrueFalseTotal
(shift())->errcode == 0 ? : 0 0 0
85  
86 sub result_status
87 {
88 0 ▶ my $self=shift;
Subroutine result_status: not called CC=1 SCAR=6.9
Pod undocumented
89 0 my $c=$self->errcode();
90 0 my $rs=Net::DRI::Protocol::ResultStatus->new('das',$c,'COMMAND_SUCCESSFUL_END',$self->is_success());
91 0 $rs->_set_trid([ $self->cltrid(),undef ]);
92 0 return $rs;
93 }
94  
95 sub as_string
96 {
97 0 ▶ my ($self)=@_;
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
98 0 my $s=sprintf("testdomain %s\x0d\x0a",$self->command_param());
99 0 return $s;
100 }
101  
102 sub parse
103 {
104 0 ▶ my ($self,$dc,$rinfo)=@_;
Subroutine parse: not called CC=3 SCAR=24.8
Pod undocumented
105 0 my @d=$dc->as_array();
106 0 ▶ Net::DRI::Exception->die(0,'protocol/DAS',1,'Unsuccessfull parse, not exactly 2 lines in server reply') unless (@d==2);
Branch: 1 branch
BranchTrueFalseTotal
unless @d == 2 0 0 0
107 0 ▶ my $e=($d[0]=~m/Yes/)? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$d[0] =~ /Yes/ ? : 0 0 0
108 0 my ($dom)=($d[1]=~m/^(\S+) is /);
109 0 $self->errcode(0);
110 0 $self->errmsg($d[0].', '.$d[1]);
111 0 $self->response([$dom,$e]);
112 0 return;
113 }
114  
115 ####################################################################################################
116 1 1;
« DRI/Protocol/OpenSRS/XCP/Account.pm ↑ Summary DRI/Cache.pm »