DRI/Protocol/DAS/SIDN/Message.pm

filter: Statementstmt 42.5% 17 / 40 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 5 / 10 Podpod 20.0% 1 / 5 totaltotal 32.3% 23 / 71 CC 6 SCAR 20.2
CC
6
Cov
33%
new
20.0
is_success
6.0
parse
6.0
CRAP 7.5
« DRI/Protocol/DAS/AU/Message.pm ↑ Summary DRI.pm »
1 ## Domain Registry Interface, .NL 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::SIDN::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::SIDN::Message - .NL 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("is %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=2 SCAR=17.9
Pod undocumented
105 0 my @d=$dc->as_array();
106 0 ▶ Net::DRI::Exception->die(0,'protocol/DAS',1,'Unsuccessfull parse, not exactly one line in server reply') unless (@d==1);
Branch: 1 branch
BranchTrueFalseTotal
unless @d == 1 0 0 0
107 0 $self->errcode(0);
108 0 $self->errmsg($d[0]);
109 0 $self->response($d[0]);
110 0 return;
111 }
112  
113 ####################################################################################################
114 1 1;
« DRI/Protocol/DAS/AU/Message.pm ↑ Summary DRI.pm »