| 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: Command.pm,v 1.4 2011/12/03 11:44:51 gavin Exp $ | 
| 6 |  |  |  |  |  |  | package Net::EPP::Frame::Command; | 
| 7 | 1 |  |  | 1 |  | 461 | use Net::EPP::Frame::Command::Check; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 8 | 1 |  |  | 1 |  | 404 | use Net::EPP::Frame::Command::Create; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 32 |  | 
| 9 | 1 |  |  | 1 |  | 391 | use Net::EPP::Frame::Command::Delete; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 34 |  | 
| 10 | 1 |  |  | 1 |  | 385 | use Net::EPP::Frame::Command::Info; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 40 |  | 
| 11 | 1 |  |  | 1 |  | 443 | use Net::EPP::Frame::Command::Login; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 43 |  | 
| 12 | 1 |  |  | 1 |  | 391 | use Net::EPP::Frame::Command::Logout; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 43 |  | 
| 13 | 1 |  |  | 1 |  | 386 | use Net::EPP::Frame::Command::Poll; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 47 |  | 
| 14 | 1 |  |  | 1 |  | 402 | use Net::EPP::Frame::Command::Renew; | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 1 |  |  |  |  | 47 |  | 
| 15 | 1 |  |  | 1 |  | 435 | use Net::EPP::Frame::Command::Transfer; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 59 |  | 
| 16 | 1 |  |  | 1 |  | 488 | use Net::EPP::Frame::Command::Update; | 
|  | 1 |  |  |  |  | 10 |  | 
|  | 1 |  |  |  |  | 68 |  | 
| 17 | 1 |  |  | 1 |  | 13 | use base qw(Net::EPP::Frame); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 256 |  | 
| 18 | 1 |  |  | 1 |  | 8 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 519 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | =pod | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | =head1 NAME | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | Net::EPP::Frame::Command - an instance of L for client commands | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | This module is a base class for the Net::EPP::Frame::* subclasses, you should | 
| 29 |  |  |  |  |  |  | never need to access it directly. | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | =head1 OBJECT HIERARCHY | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | L | 
| 34 |  |  |  |  |  |  | +----L | 
| 35 |  |  |  |  |  |  | +----L | 
| 36 |  |  |  |  |  |  | +----L | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =cut | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | sub new { | 
| 41 | 0 |  |  | 0 | 1 |  | my $package = shift; | 
| 42 | 0 |  |  |  |  |  | my $self = $package->SUPER::new('command'); | 
| 43 | 0 |  |  |  |  |  | return bless($self, $package); | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | sub addObject() { | 
| 47 | 0 |  |  | 0 | 0 |  | my ($self, $object, $ns, $schema) = @_; | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 0 |  |  |  |  |  | my $obj = $self->createElement($self->getCommandType); | 
| 50 | 0 |  |  |  |  |  | $obj->setNamespace($ns, $object); | 
| 51 | 0 |  |  |  |  |  | $self->getNode($self->getCommandType)->addChild($obj); | 
| 52 |  |  |  |  |  |  |  | 
| 53 | 0 |  |  |  |  |  | return $obj; | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | sub _addExtraElements { | 
| 57 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 58 |  |  |  |  |  |  |  | 
| 59 | 0 | 0 |  |  |  |  | $self->command->addChild($self->createElement($self->getCommandType)) if ($self->getCommandType ne ''); | 
| 60 | 0 |  |  |  |  |  | $self->command->addChild($self->createElement('clTRID')); | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 0 |  |  |  |  |  | $self->_addCommandElements; | 
| 63 | 0 |  |  |  |  |  | return 1; | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  | 0 |  |  | sub _addCommandElements { | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | =pod | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | =head1 METHODS | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | my $object = $frame->addObject(@spec); | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | This method creates and returns a new element corresponding to the data in | 
| 76 |  |  |  |  |  |  | C<@spec>, and appends it to the "command" element (as returned by the | 
| 77 |  |  |  |  |  |  | C method below). | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | The L module can be used to quickly retrieve EPP | 
| 80 |  |  |  |  |  |  | object specifications. | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | my $type = $frame->getCommandType; | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | This method returns a scalar containing the command type (eg L<'create'>). | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | my $type = $frame->getCommandNode; | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | This method returns the L object corresponding to the | 
| 89 |  |  |  |  |  |  | command in question, eg the CcreateE> element (for a | 
| 90 |  |  |  |  |  |  | L object). It is within this element that | 
| 91 |  |  |  |  |  |  | EPP objects are placed. | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | my $node = $frame->command; | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | This method returns the L object corresponding to the | 
| 96 |  |  |  |  |  |  | CcommandE> element. | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | my $node = $frame->clTRID; | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | This method returns the L object corresponding to the | 
| 101 |  |  |  |  |  |  | CclTRIDE> element. | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =cut | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | sub getCommandType { | 
| 106 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 107 | 0 |  |  |  |  |  | my $type = ref($self); | 
| 108 | 0 |  |  |  |  |  | my $me = __PACKAGE__; | 
| 109 | 0 |  |  |  |  |  | $type =~ s/^$me\:+//; | 
| 110 | 0 |  |  |  |  |  | $type =~ s/\:{2}.+//; | 
| 111 | 0 |  |  |  |  |  | return lc($type); | 
| 112 |  |  |  |  |  |  | } | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | sub getCommandNode { | 
| 115 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 116 | 0 |  |  |  |  |  | return $self->getNode($self->getCommandType); | 
| 117 |  |  |  |  |  |  | } | 
| 118 |  |  |  |  |  |  |  | 
| 119 | 0 |  |  | 0 | 1 |  | sub command { $_[0]->getNode('command') } | 
| 120 | 0 |  |  | 0 | 0 |  | sub clTRID { $_[0]->getNode('clTRID') } | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | 1; |