File Coverage

blib/lib/Net/EPP/Frame/Command/Check/Host.pm
Criterion Covered Total %
statement 9 18 50.0
branch n/a
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 12 25 48.0


line stmt bran cond sub pod time code
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 $
6             package Net::EPP::Frame::Command::Check::Host;
7 1     1   3 use base qw(Net::EPP::Frame::Command::Check);
  1         1  
  1         57  
8 1     1   4 use Net::EPP::Frame::ObjectSpec;
  1         1  
  1         12  
9 1     1   2 use strict;
  1         1  
  1         95  
10              
11             =pod
12              
13             =head1 NAME
14              
15             Net::EPP::Frame::Command::Check::Host - an instance of L
16             for 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              
30             This results in an XML document like this:
31              
32            
33            
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            
38            
39            
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             ns0.example-1.tldE/host:name>
44             ns1.example-2.tldE/host:name>
45             ns2.example-3.tldE/host:name>
46            
47            
48             0cf1b8f7e14547d26f03b7641660c641d9e79f45
49            
50            
51              
52             =head1 OBJECT HIERARCHY
53              
54             L
55             +----L
56             +----L
57             +----L
58             +----L
59             +----L
60              
61             =cut
62              
63             sub new {
64 0     0 0   my $package = shift;
65 0           my $self = bless($package->SUPER::new('check'), $package);
66              
67 0           $self->addObject(Net::EPP::Frame::ObjectSpec->spec('host'));
68              
69 0           return $self;
70             }
71              
72             =pod
73              
74             =head1 METHODS
75              
76             $frame->addHost($host_name);
77              
78             This adds a hostname to the list of hosts to be checked.
79              
80             =cut
81              
82             sub addHost {
83 0     0 0   my ($self, $host) = @_;
84              
85 0           my $name = $self->createElement('host:name');
86 0           $name->appendText($host);
87              
88 0           $self->getNode('check')->getChildNodes->shift->appendChild($name);
89              
90 0           return 1;
91             }
92              
93             =pod
94              
95             =head1 AUTHOR
96              
97             CentralNic Ltd (http://www.centralnic.com/).
98              
99             =head1 COPYRIGHT
100              
101             This module is (c) 2016 CentralNic Ltd. This module is free software; you can
102             redistribute it and/or modify it under the same terms as Perl itself.
103              
104             =head1 SEE ALSO
105              
106             =over
107              
108             =item * L
109              
110             =back
111              
112             =cut
113              
114             1;