EPP/Frame/Command/Create/Contact.pm

filter: Statementstmt 17.5% 10 / 57 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 3 / 12 Podpod 11.1% 1 / 9 totaltotal 16.6% 14 / 84 CC 6 SCAR 23.5
CC
6
Cov
16%
addPostalInfo
30.0
addEl
6.0
new
2.0
CRAP 10.5
« EPP/Frame/Command/Update/Domain.pm ↑ Summary EPP/Frame/Command/Update/Contact.pm »
1 package Net::EPP::Frame::Command::Create::Contact;
2 1 ▶use base qw(Net::EPP::Frame::Command::Create);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Net::EPP::Frame::ObjectSpec;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =pod
7  
8 =head1 NAME
9  
10 Net::EPP::Frame::Command::Create::Contact - an instance of L<Net::EPP::Frame::Command::Create>
11 for contact objects.
12  
13 =head1 SYNOPSIS
14  
15 use Net::EPP::Frame::Command::Create::Contact;
16 use strict;
17  
18 my $create = Net::EPP::Frame::Command::Create::Contact->new;
19 $create->setContact('contact-id);
20  
21 print $create->toString(1);
22  
23 This results in an XML document like this:
24  
25 <?xml version="1.0" encoding="UTF-8"?>
26 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
27 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
28 xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
29 epp-1.0.xsd">
30 <command>
31 <check>
32 <contact:create
33 xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
34 xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0
35 contact-1.0.xsd">
36 <contact:id>example-1.tldE<lt>/contact:id>
37 </contact:create>
38 </check>
39 <clTRID>0cf1b8f7e14547d26f03b7641660c641d9e79f45</clTRIDE<gt>
40 </command>
41 </epp>
42  
43 =head1 OBJECT HIERARCHY
44  
45 L<XML::LibXML::Node>
46 +----L<XML::LibXML::Document>
47 +----L<Net::EPP::Frame>
48 +----L<Net::EPP::Frame::Command>
49 +----L<Net::EPP::Frame::Command::Create>
50 +----L<Net::EPP::Frame::Command::Create::Contact>
51  
52 =cut
53  
54 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
55 0 my $package = shift;
56 0 my $self = bless($package->SUPER::new('create'), $package);
57  
58 0 $self->addObject(Net::EPP::Frame::ObjectSpec->spec('contact'));
59  
60 0 return $self;
61 }
62  
63 =pod
64  
65 =head1 METHODS
66  
67 my $element = $frame->setContact($contact_id);
68  
69 This sets the contact ID of the object to be created. Returns the
70 C<E<lt>contact:nameE<gt>> element.
71  
72 =cut
73  
74 0 ▶sub setContact {
Subroutine setContact: not called CC=1 SCAR=6.9
Pod undocumented
75 0 my ($self, $id) = @_;
76 0 return $self->addEl('id', $id);
77 }
78  
79 0 ▶sub setVoice {
Subroutine setVoice: not called CC=1 SCAR=6.9
Pod undocumented
80 0 my ($self, $voice) = @_;
81 0 return $self->addEl('voice', $voice);
82 }
83  
84 0 ▶sub setFax {
Subroutine setFax: not called CC=1 SCAR=6.9
Pod undocumented
85 0 my ($self, $fax) = @_;
86 0 return $self->addEl('fax', $fax);
87 }
88  
89 0 ▶sub setEmail {
Subroutine setEmail: not called CC=1 SCAR=6.9
Pod undocumented
90 0 my ($self, $email) = @_;
91 0 return $self->addEl('email', $email);
92 }
93  
94 0 ▶sub setAuthInfo {
Subroutine setAuthInfo: not called CC=1 SCAR=6.9
Pod undocumented
95 0 my ($self, $authInfo) = @_;
96 0 my $el = $self->addEl('authInfo');
97 0 my $pw = $self->createElement('contact:pw');
98 0 $pw->appendText($authInfo);
99 0 $el->appendChild($pw);
100 0 return $el;
101 }
102  
103 0 ▶sub addPostalInfo {
Subroutine addPostalInfo: not called CC=5 SCAR=34.0
Pod undocumented
104 0 my ($self, $type, $name, $org, $addr) = @_;
105 0 my $el = $self->addEl('postalInfo');
106 0 $el->setAttribute('type', $type);
107  
108 0 my $nel = $self->createElement('contact:name');
109 0 $nel->appendText($name);
110  
111 0 my $oel = $self->createElement('contact:org');
112 0 $oel->appendText($org);
113  
114 0 my $ael = $self->createElement('contact:addr');
115  
116 0 ▶ if (ref($addr->{street}) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $addr->{"street"} eq "ARRAY") 0 0 0
117 0 foreach my $street (@{$addr->{street}}) {
118 0 my $sel = $self->createElement('contact:street');
119 0 $sel->appendText($street);
120 0 $ael->appendChild($sel);
121 }
122 }
123  
124 0 foreach my $name (qw(city sp pc cc)) {
125 0 my $vel = $self->createElement('contact:' . $name);
126 0 $vel->appendText($addr->{$name});
127 0 $ael->appendChild($vel);
128 }
129  
130 0 $el->appendChild($nel);
131 0 ▶ $el->appendChild($oel) if $org;
Branch: 1 branch
BranchTrueFalseTotal
if $org 0 0 0
132 0 $el->appendChild($ael);
133  
134 0 return $el;
135 }
136  
137 0 ▶sub appendStatus {
Subroutine appendStatus: not called CC=1 SCAR=6.9
Pod undocumented
138 0 my ($self, $status) = @_;
139 0 return $self->addEl('status', $status);
140 }
141  
142 0 ▶sub addEl {
Subroutine addEl: not called CC=2 SCAR=17.9
Pod undocumented
143 0 my ($self, $name, $value) = @_;
144  
145 0 my $el = $self->createElement('contact:' . $name);
146 0 ▶ $el->appendText($value) if defined($value);
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 0 0 0
147  
148 0 $self->getNode('create')->getChildNodes->shift->appendChild($el);
149  
150 0 return $el;
151  
152 }
153  
154 1 1;
« EPP/Frame/Command/Update/Domain.pm ↑ Summary EPP/Frame/Command/Update/Contact.pm »