1# Copyright (c) 2016 CentralNic Ltd. All rights reserved. This program is 2# free software; you can redistribute it and/or modify it under the same 3# terms as Perl itself. 4# 5# $Id: Host.pm,v 1.3 2011/12/03 11:44:52 gavin Exp $ 6package Net::EPP::Frame::Command::Check::Host; 7use base qw(Net::EPP::Frame::Command::Check); 8use Net::EPP::Frame::ObjectSpec; 9use strict; 10 11=pod 12 13=head1 NAME 14 15Net::EPP::Frame::Command::Check::Host - an instance of L<Net::EPP::Frame::Command::Check> 16for host objects. 17 18=head1 SYNOPSIS 19 20 use Net::EPP::Frame::Command::Check::Host; 21 use strict; 22 23 my $check = Net::EPP::Frame::Command::Check::Host->new; 24 $check->addHost('example-1.tld'); 25 $check->addHost('example-2.tld'); 26 $check->addHost('example-2.tld'); 27 28 print $check->toString(1); 29 30This results in an XML document like this: 31 32 <?xml version="1.0" encoding="UTF-8"?> 33 <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" 34 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 35 xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 36 epp-1.0.xsd"> 37 <command> 38 <check> 39 <host:check 40 xmlns:host="urn:ietf:params:xml:ns:host-1.0" 41 xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 42 host-1.0.xsd"> 43 <host:name>ns0.example-1.tldE<lt>/host:name> 44 <host:name>ns1.example-2.tldE<lt>/host:name> 45 <host:name>ns2.example-3.tldE<lt>/host:name> 46 </host:check> 47 </check> 48 <clTRID>0cf1b8f7e14547d26f03b7641660c641d9e79f45</clTRIDE<gt> 49 </command> 50 </epp> 51 52=head1 OBJECT HIERARCHY 53 54 L<XML::LibXML::Node> 55 +----L<XML::LibXML::Document> 56 +----L<Net::EPP::Frame> 57 +----L<Net::EPP::Frame::Command> 58 +----L<Net::EPP::Frame::Command::Check> 59 +----L<Net::EPP::Frame::Command::Check::Host> 60 61=cut 62 63sub new { 64 my $package = shift; 65 my $self = bless($package->SUPER::new('check'), $package); 66 67 $self->addObject(Net::EPP::Frame::ObjectSpec->spec('host')); 68 69 return $self; 70} 71 72=pod 73 74=head1 METHODS 75 76 $frame->addHost($host_name); 77 78This adds a hostname to the list of hosts to be checked. 79 80=cut 81 82sub addHost { 83 my ($self, $host) = @_; 84 85 my $name = $self->createElement('host:name'); 86 $name->appendText($host); 87 88 $self->getNode('check')->getChildNodes->shift->appendChild($name); 89 90 return 1; 91} 92 93=pod 94 95=head1 AUTHOR 96 97CentralNic Ltd (http://www.centralnic.com/). 98 99=head1 COPYRIGHT 100 101This module is (c) 2016 CentralNic Ltd. This module is free software; you can 102redistribute it and/or modify it under the same terms as Perl itself. 103 104=head1 SEE ALSO 105 106=over 107 108=item * L<Net::EPP::Frame> 109 110=back 111 112=cut 113 1141; 115