/usr/share/perl5/Net/EPP/Frame/Command/Update/Host.pm is in libnet-epp-perl 0.22-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | # Copyright (c) 2016 CentralNic Ltd. All rights reserved. This program is
# free software; you can redistribute it and/or modify it under the same
# terms as Perl itself.
#
# $Id: Host.pm,v 1.3 2011/01/23 12:26:24 gavin Exp $
package Net::EPP::Frame::Command::Update::Host;
use base qw(Net::EPP::Frame::Command::Update);
use Net::EPP::Frame::ObjectSpec;
use strict;
=pod
=head1 NAME
Net::EPP::Frame::Command::Update::Host - an instance of L<Net::EPP::Frame::Command::Update>
for host objects.
=head1 SYNOPSIS
use Net::EPP::Frame::Command::Update::Host;
use strict;
my $info = Net::EPP::Frame::Command::Update::Host->new;
$info->setHost('ns0.example.tld');
print $info->toString(1);
This results in an XML document like this:
<?xml version="1.0" encoding="UTF-8"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0
epp-1.0.xsd">
<command>
<info>
<host:update
xmlns:host="urn:ietf:params:xml:ns:host-1.0"
xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0
host-1.0.xsd">
<host:name>example-1.tldE<lt>/host:name>
</host:update>
</info>
<clTRID>0cf1b8f7e14547d26f03b7641660c641d9e79f45</clTRIDE<gt>
</command>
</epp>
=head1 OBJECT HIERARCHY
L<XML::LibXML::Node>
+----L<XML::LibXML::Document>
+----L<Net::EPP::Frame>
+----L<Net::EPP::Frame::Command>
+----L<Net::EPP::Frame::Command::Update>
+----L<Net::EPP::Frame::Command::Update::Host>
=cut
sub new {
my $package = shift;
my $self = bless($package->SUPER::new('update'), $package);
my $host = $self->addObject(Net::EPP::Frame::ObjectSpec->spec('host'));
# 'chg' element's contents are not optional for hosts, so we'll add
# this element only when we plan to use it (accessor is overriden)
foreach my $grp (qw(add rem)) {
my $el = $self->createElement(sprintf('host:%s', $grp));
$self->getNode('update')->getChildNodes->shift->appendChild($el);
}
return $self;
}
=pod
=head1 METHODS
$frame->setHost($host_name);
This specifies the host object to be updated.
=cut
sub setHost {
my ($self, $host) = @_;
my $name = $self->createElement('host:name');
$name->appendText($host);
my $n = $self->getNode('update')->getChildNodes->shift;
$n->insertBefore($name, $n->firstChild);
return 1;
}
=pod
$frame->addStatus($type, $info);
Add a status of $type with the optional extra $info.
=cut
sub addStatus {
my ($self, $type, $info) = @_;
my $status = $self->createElement('host:status');
$status->setAttribute('s', $type);
$status->setAttribute('lang', 'en');
if ($info) {
$status->appendText($info);
}
$self->getElementsByLocalName('host:add')->shift->appendChild($status);
return 1;
}
=pod
$frame->remStatus($type);
Remove a status of $type.
=cut
sub remStatus {
my ($self, $type) = @_;
my $status = $self->createElement('host:status');
$status->setAttribute('s', $type);
$self->getElementsByLocalName('host:rem')->shift->appendChild($status);
return 1;
}
=pod
$frame->addAddr({ 'ip' => '10.0.0.1', 'version' => 'v4' });
Add a set of IP addresses to the host object. EPP supports multiple
addresses of different versions.
=cut
sub addAddr {
my ($self, @addr) = @_;
foreach my $ip (@addr) {
my $el = $self->createElement('host:addr');
$el->appendText($ip->{ip});
$el->setAttribute('ip', $ip->{version});
$self->getElementsByLocalName('host:add')->shift->appendChild($el);
}
return 1;
}
=pod
$frame->remAddr({ 'ip' => '10.0.0.2', 'version' => 'v4' });
Remove a set of IP addresses from the host object. EPP supports multiple
addresses of different versions.
=cut
sub remAddr {
my ($self, @addr) = @_;
foreach my $ip (@addr) {
my $el = $self->createElement('host:addr');
$el->appendText($ip->{ip});
$el->setAttribute('ip', $ip->{version});
$self->getElementsByLocalName('host:rem')->shift->appendChild($el);
}
return 1;
}
=pod
my $el = $frame->chg;
Lazy-building of 'host:chg'element.
=cut
sub chg {
my $self = shift;
my $chg = $self->getElementsByLocalName('host:chg')->shift;
if ( $chg ) {
return $chg;
}
else {
my $el = $self->createElement('host:chg');
$self->getNode('update')->getChildNodes->shift->appendChild($el);
return $el;
}
}
=pod
$frame->chgName('ns2.example.com');
Change a name of host.
=cut
sub chgName {
my ($self, $name) = @_;
my $el = $self->createElement('host:name');
$el->appendText($name);
$self->chg->appendChild($el);
}
=pod
=head1 AUTHOR
CentralNic Ltd (http://www.centralnic.com/).
=head1 COPYRIGHT
This module is (c) 2016 CentralNic Ltd. This module is free software; you can
redistribute it and/or modify it under the same terms as Perl itself.
=head1 SEE ALSO
=over
=item * L<Net::EPP::Frame>
=back
=cut
1;
|