DRI/Data/Contact/SE.pm

filter: Statementstmt 53.8% 14 / 26 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 30.5% 18 / 59 CC 9 SCAR 30.8
CC
9
Cov
31%
validate
30.0
init
30.0
BEGIN
1.0
CRAP 21.7
« DRI/Protocol/EPP/Extensions/VeriSign/Balance.pm ↑ Summary DRI/Protocol/EPP/Extensions/CAT/Contact.pm »
1 ## Domain Registry Interface, Handling of contact data for .SE
2 ## Contributed by Elias Sidenbladh and Ulrich Wisser from NIC SE
3 ##
4 ## Copyright (c) 2006-2009,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
5 ##
6 ## This file is part of Net::DRI
7 ##
8 ## Net::DRI is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 2 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## See the LICENSE file that comes with this distribution for more details.
14 #########################################################################################
15  
16 package Net::DRI::Data::Contact::SE;
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use base qw/Net::DRI::Data::Contact/;
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 __PACKAGE__->register_attributes(qw(orgno vatno));
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Data::Contact::SE - Handle .SE contact data for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 This subclass of Net::DRI::Data::Contact adds accessors and validation for
34 .SE specific data.
35  
36 =head1 METHODS
37  
38 The following accessors/mutators can be called in chain, as they all return the object itself.
39 The class also have all the accessors/mutators Net::DRI::Data::Contact has.
40  
41 =head2 orgno()
42  
43 Organization registration number for companies or social security number for
44 individuals on the form [<CC>]<no> where <CC> is the country code and <nr> is the
45 organization registration number or the social security number (mandatory)
46  
47 =head1 SUPPORT
48  
49 For now, support questions should be sent to:
50  
51 E<lt>netdri@dotandco.comE<gt>
52  
53 Please also see the SUPPORT file in the distribution.
54  
55 =head1 SEE ALSO
56  
57 http://www.dotandco.com/services/software/Net-DRI/
58  
59 =head1 AUTHOR
60  
61 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
62  
63 =head1 COPYRIGHT
64  
65 Copyright (c) 2006-2009,2013 Patrick Mevzek <netdri@dotandco.com>.
66 All rights reserved.
67  
68 This program is free software; you can redistribute it and/or modify
69 it under the terms of the GNU General Public License as published by
70 the Free Software Foundation; either version 2 of the License, or
71 (at your option) any later version.
72  
73 See the LICENSE file that comes with this distribution for more details.
74  
75 =cut
76  
77 ####################################################################################################
78  
79 sub validate
80 {
81 0 ▶ my ($self,$change)=@_;
Subroutine validate: not called CC=5 SCAR=34.0
Pod undocumented
82 0 ▶ $change||=0;
Condition0%0/2
$change ||= 0
l!l
00
MC/DC0%0/1
$change ||= 0
$change
Truth table0%0/2
A
A= $change
Aresult
11
00
83 0 my @errs;
84  
85 # call parent validate, will trigger an Exception if problem
86 0 $self->SUPER::validate($change); ## will trigger an Exception if problem
87  
88 # validate our extensions
89 0 ▶ push @errs, 'orgno' if ( $self->orgno() && $self->orgno() !~ m/^\[[A-Z]{2}\]/ );
Branch: 1 branch
BranchTrueFalseTotal
if $self->orgno and not $self->orgno =~ /^\[[A-Z]{2}\]/ 0 0 0
Condition0%0/3
$self->orgno and not $self->orgno =~ /^\[[A-Z]{2}\]/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->orgno and not $self->orgno =~ /^\[[A-Z]{2}\]/
$self->orgno not $self->orgno =~ /^\[[A-Z]{2}\]/
Truth table0%0/3
A and not(B)
A= $self->orgnoB= not $self->orgno =~ /^\[[A-Z]{2}\]/
ABresult
0X0
100
111
90  
91 # throw exception if errors detected
92 0 ▶ Net::DRI::Exception::usererr_invalid_parameters( 'Invalid contact information: ' . join( '/', @errs ) ) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
93  
94 # done, everything ok
95 0 return 1;
96 }
97  
98 sub init
99 {
100 0 ▶ my ($self,$what,$ndr)=@_;
Subroutine init: not called CC=5 SCAR=34.0
Pod undocumented
101  
102 0 ▶ if ($what eq 'create')
Branch: 1 branch
BranchTrueFalseTotal
if ($what eq "create") 0 0 0
103 {
104 0 my $a=$self->auth();
105 0 ▶ $self->auth({pw=>''}) unless ($a && (ref($a) eq 'HASH') && exists($a->{pw}));
Branch: 1 branch
BranchTrueFalseTotal
unless $a and ref $a eq "HASH" and exists $a->{"pw"} 0 0 0
Condition0%0/6
$a and ref $a eq "HASH" and exists $a->{"pw"}
!ll&&!rl&&r
000
$a and ref $a eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/3
$a and ref $a eq "HASH" and exists $a->{"pw"}
$a ref $a eq "HASH" exists $a->{"pw"}
Truth table0%0/4
A and B and C
A= $aB= ref $a eq "HASH"C= exists $a->{"pw"}
ABCresult
0XX0
10X0
1100
1111
106 }
107 0 return;
108 }
109  
110  
111 ####################################################################################################
112 1 1;
« DRI/Protocol/EPP/Extensions/VeriSign/Balance.pm ↑ Summary DRI/Protocol/EPP/Extensions/CAT/Contact.pm »