| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ## Domain Registry Interface, CIRA EPP Agreement commands | 
| 2 |  |  |  |  |  |  | ## | 
| 3 |  |  |  |  |  |  | ## Copyright (c) 2010,2013 Patrick Mevzek . All rights reserved. | 
| 4 |  |  |  |  |  |  | ## | 
| 5 |  |  |  |  |  |  | ## This file is part of Net::DRI | 
| 6 |  |  |  |  |  |  | ## | 
| 7 |  |  |  |  |  |  | ## Net::DRI is free software; you can redistribute it and/or modify | 
| 8 |  |  |  |  |  |  | ## it under the terms of the GNU General Public License as published by | 
| 9 |  |  |  |  |  |  | ## the Free Software Foundation; either version 2 of the License, or | 
| 10 |  |  |  |  |  |  | ## (at your option) any later version. | 
| 11 |  |  |  |  |  |  | ## | 
| 12 |  |  |  |  |  |  | ## See the LICENSE file that comes with this distribution for more details. | 
| 13 |  |  |  |  |  |  | #################################################################################################### | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | package Net::DRI::Protocol::EPP::Extensions::CIRA::Agreement; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1 |  |  | 1 |  | 921 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 18 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 39 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 1 |  |  | 1 |  | 3 | use Net::DRI::Util; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 279 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | #################################################################################################### | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | sub register_commands | 
| 25 |  |  |  |  |  |  | { | 
| 26 | 0 |  |  | 0 | 0 |  | my ($class,$version)=@_; | 
| 27 | 0 |  |  |  |  |  | return { 'agreement' => { get => [ \&get, \&get_parse ] } }; | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub get | 
| 31 |  |  |  |  |  |  | { | 
| 32 | 0 |  |  | 0 | 0 |  | my ($epp,$language)=@_; | 
| 33 | 0 |  |  |  |  |  | my $mes=$epp->message(); | 
| 34 | 0 |  |  |  |  |  | my $eid=$mes->command_extension_register('cira:ciraInfo',sprintf('xmlns:cira="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('cira'))); | 
| 35 | 0 | 0 |  |  |  |  | $mes->command_extension($eid,[['cira:action','get CIRA latest agreement'],['cira:language',defined $language ? $language : 'en']]); | 
| 36 | 0 |  |  |  |  |  | return; | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub get_parse | 
| 40 |  |  |  |  |  |  | { | 
| 41 | 0 |  |  | 0 | 0 |  | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | 
| 42 | 0 |  |  |  |  |  | my $mes=$po->message(); | 
| 43 | 0 | 0 |  |  |  |  | return unless $mes->is_success(); | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 0 |  |  |  |  |  | my $infdata=$mes->get_extension('cira','ciraInfo'); | 
| 46 | 0 | 0 |  |  |  |  | return unless defined $infdata; | 
| 47 |  |  |  |  |  |  |  | 
| 48 | 0 |  |  |  |  |  | foreach my $el (Net::DRI::Util::xml_list_children($infdata)) | 
| 49 |  |  |  |  |  |  | { | 
| 50 | 0 |  |  |  |  |  | my ($name,$c)=@$el; | 
| 51 | 0 | 0 |  |  |  |  | if ($name eq 'language') | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | { | 
| 53 | 0 |  |  |  |  |  | $rinfo->{agreement}->{cira}->{lang}=$c->textContent(); | 
| 54 |  |  |  |  |  |  | } elsif ($name eq 'ciraAgreementVersion') | 
| 55 |  |  |  |  |  |  | { | 
| 56 | 0 |  |  |  |  |  | $rinfo->{agreement}->{cira}->{version}=$c->textContent(); | 
| 57 |  |  |  |  |  |  | } elsif ($name eq 'ciraAgreement') | 
| 58 |  |  |  |  |  |  | { | 
| 59 | 0 |  |  |  |  |  | $rinfo->{agreement}->{cira}->{content}=$c->textContent(); | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  | } | 
| 62 | 0 |  |  |  |  |  | return; | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | #################################################################################################### | 
| 66 |  |  |  |  |  |  | 1; | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | __END__ |