DRI/DRD/CIRA.pm

filter: Statementstmt 60.3% 32 / 53 Branchbran 12.5% 1 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 68.7% 11 / 16 Podpod 44.4% 4 / 9 totaltotal 50.0% 48 / 96 CC 7 SCAR 25.2
CC
7
Cov
49%
agreement_get
42.0
transport_protocol_default
2.3
periods
2.0
CRAP 12.5
« DRI/Data/Hosts.pm ↑ Summary DRI/Protocol/EPP/Extensions/EURid/IDN.pm »
1 ## Domain Registry Interface, CIRA (.CA) Registry Driver
2 ##
3 ## Copyright (c) 2010-2011,2018 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::DRD::CIRA;
16  
17 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 3 ▶use base qw/Net::DRI::DRD/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 3 ▶use DateTime::Duration;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 3 ▶use Net::DRI::Data::Raw;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 ▶use Net::DRI::Protocol::EPP::Message;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 3 __PACKAGE__->make_exception_for_unavailable_operations(qw/domain_transfer_stop domain_transfer_query domain_transfer_accept domain_transfer_refuse/);
28  
29 ####################################################################################################
30  
31 sub new
32 {
33 2 ▶ my $class=shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
34 2 my $self=$class->SUPER::new(@_);
35 2 $self->{info}->{host_as_attr}=0;
36 2 $self->{info}->{contact_i18n}=1; ## LOC only
37 2 return $self;
38 }
39  
40 0 ▶sub periods { return map { DateTime::Duration->new(years => $_) } (1..10); }
Subroutine periods: not called CC=1 SCAR=6.9
Pod documented
41 2 ▶sub name { return 'CIRA'; }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
42 2 ▶sub tlds { return (qw/ca/); }
Subroutine tlds: called CC=1 SCAR=0.0
Pod documented
43 0 ▶sub object_types { return (qw/domain contact ns/); }
Subroutine object_types: not called CC=1 SCAR=6.9
Pod documented
44 0 ▶sub profile_types { return qw/epp/; }
Subroutine profile_types: not called CC=1 SCAR=6.9
Pod undocumented
45  
46 sub transport_protocol_default
47 {
48 2 ▶ my ($self,$type)=@_;
Subroutine transport_protocol_default: called CC=2 SCAR=8.1
Pod undocumented
49  
50 2 ▶ return ('Net::DRI::Transport::Socket',{},'Net::DRI::Protocol::EPP::Extensions::CIRA',{}) if $type eq 'epp';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "epp" 2 0 2
51 0 return;
52 }
53  
54 ####################################################################################################
55  
56 sub verify_name_domain
57 {
58 0 ▶ my ($self,$ndr,$domain,$op)=@_;
Subroutine verify_name_domain: not called CC=1 SCAR=6.9
Pod undocumented
59 0 return $self->_verify_name_rules($domain,$op,{check_name=>1,check_name_dots=>[1,2,3],my_tld_not_strict=>1});
60 }
61  
62 sub agreement_get
63 {
64 0 ▶ my ($self,$ndr,$language)=@_;
Subroutine agreement_get: not called CC=6 SCAR=37.4
Pod undocumented
65 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('CIRA agreement language must be "en" or "fr"') if (defined $language && $language!~m/^(?:fr|en)$/);
Branch: 1 branch
BranchTrueFalseTotal
if defined $language and not $language =~ /^(?:fr|en)$/ 0 0 0
Condition0%0/3
defined $language and not $language =~ /^(?:fr|en)$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $language and not $language =~ /^(?:fr|en)$/
defined $language not $language =~ /^(?:fr|en)$/
Truth table0%0/3
A and not(B)
A= defined $languageB= not $language =~ /^(?:fr|en)$/
ABresult
0X0
100
111
66  
67 ## This is an hack until the registry fix their EPP extension.
68 0 ▶ my $cmd='<?xml version="1.0" encoding="UTF-8" standalone="no"?><epp xmlns="urn:ietf:params:xml:ns:epp-1.0"><command><extension><cira:ciraInfo xmlns:cira="urn:ietf:params:xml:ns:cira-1.0"><cira:action>get CIRA latest agreement</cira:action><cira:language>'.(defined $language && length $language ? $language : 'en').'</cira:language></cira:ciraInfo></extension></command></epp>';
Branch: 1 branch
BranchTrueFalseTotal
defined $language && length $language ? : 0 0 0
Condition0%0/3
defined $language and length $language
!ll&&!rl&&r
000
MC/DC0%0/2
defined $language and length $language
defined $language length $language
Truth table0%0/3
A and B
A= defined $languageB= length $language
ABresult
0X0
100
111
69 0 my $ans=$self->SUPER::raw_command($ndr,$cmd);
70 0 my $dr=Net::DRI::Data::Raw->new_from_xmlstring($ans);
71 0 my $mes=Net::DRI::Protocol::EPP::Message->new();
72 0 $mes->version('1.0');
73 0 $mes->ns({ epp => 'urn:ietf:params:xml:ns:epp-1.0', cira=> 'urn:ietf:params:xml:ns:cira-1.0'});
74 0 $mes->parse($dr,{});
75 0 my $rc=$mes->result_status();
76 0 ▶ if ($rc->is_success())
Branch: 1 branch
BranchTrueFalseTotal
if ($rc->is_success) 0 0 0
77 {
78 0 my ($lang,$version,$content)=($ans=~m!<cira:ciraInfo xmlns:cira="urn:ietf:params:xml:ns:cira-1.0"><cira:language>(\S+)</cira:language><cira:ciraAgreementVersion>(\S+)</cira:ciraAgreementVersion><cira:ciraAgreement>(.+)</cira:ciraAgreement></cira:ciraInfo>!);
79 0 $rc->_set_data({'agreement'=>{'get'=>{lang=>$lang,version=>$version,content=>$content}}});
80 }
81 0 return $rc;
82  
83 # This would be the correct way to do it, when possible with registry:
84 # my $rc=$ndr->process('agreement','get',[$language]);
85 # return $rc;
86 }
87  
88 ####################################################################################################
89 3 1;
90  
91 __END__
92  
93 =pod
94  
95 =head1 NAME
96  
97 Net::DRI::DRD::CIRA - CIRA (.CA) Registry driver for Net::DRI
98  
99 =head1 SYNOPSIS
100  
101 $dri=Net::DRI->new();
102 $dri->add_registry('CIRA');
103  
104 =head1 DESCRIPTION
105  
106 Please see the README file for details.
107  
108 =head1 SUPPORT
109  
110 For now, support questions should be sent to:
111  
112 E<lt>netdri@dotandco.comE<gt>
113  
114 Please also see the SUPPORT file in the distribution.
115  
116 =head1 SEE ALSO
117  
118 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
119  
120 =head1 AUTHOR
121  
122 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
123  
124 =head1 COPYRIGHT
125  
126 Copyright (c) 2010-2011,2018 Patrick Mevzek <netdri@dotandco.com>.
127 All rights reserved.
128  
129 This program is free software; you can redistribute it and/or modify
130 it under the terms of the GNU General Public License as published by
131 the Free Software Foundation; either version 2 of the License, or
132 (at your option) any later version.
133  
134 See the LICENSE file that comes with this distribution for more details.
135  
136 =cut
« DRI/Data/Hosts.pm ↑ Summary DRI/Protocol/EPP/Extensions/EURid/IDN.pm »