| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ## Domain Registry Interface, Superclass of various classes for Net::DRI | 
| 2 |  |  |  |  |  |  | ## | 
| 3 |  |  |  |  |  |  | ## Copyright (c) 2009-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::BaseClass; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 81 |  |  | 81 |  | 7130 | use strict; | 
|  | 81 |  |  |  |  | 77 |  | 
|  | 81 |  |  |  |  | 1810 |  | 
| 18 | 81 |  |  | 81 |  | 228 | use warnings; | 
|  | 81 |  |  |  |  | 79 |  | 
|  | 81 |  |  |  |  | 1419 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 81 |  |  | 81 |  | 1102 | use Net::DRI::Exception; | 
|  | 81 |  |  |  |  | 80 |  | 
|  | 81 |  |  |  |  | 3212 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | #################################################################################################### | 
| 23 |  |  |  |  |  |  | ## CLASS METHODS | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | sub make_exception_if_not_implemented | 
| 26 |  |  |  |  |  |  | { | 
| 27 | 146 |  |  | 146 | 0 | 498 | my ($self,@methods)=@_; | 
| 28 | 146 |  | 33 |  |  | 853 | my $class=ref $self || $self; | 
| 29 | 146 |  |  |  |  | 335 | foreach my $name (@methods) | 
| 30 |  |  |  |  |  |  | { | 
| 31 | 81 |  |  | 81 |  | 276 | no strict 'refs'; ## no critic (ProhibitNoStrict) | 
|  | 81 |  |  |  |  | 73 |  | 
|  | 81 |  |  |  |  | 9864 |  | 
| 32 | 663 |  |  | 0 |  | 1527 | *{"${class}::${name}"}=sub { my $self=shift; Net::DRI::Exception->die(1,'internal',1,sprintf('Method %s not implemented in %s, please report.',$name,$class)); }; | 
|  | 663 |  |  |  |  | 2328 |  | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 33 |  |  |  |  |  |  | } | 
| 34 | 146 |  |  |  |  | 352 | return; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | sub make_exception_for_unavailable_operations | 
| 38 |  |  |  |  |  |  | { | 
| 39 | 29 |  |  | 29 | 0 | 136 | my ($self,@methods)=@_; | 
| 40 | 29 |  | 33 |  |  | 154 | my $class=ref $self || $self; | 
| 41 | 29 |  |  |  |  | 65 | foreach my $name (@methods) | 
| 42 |  |  |  |  |  |  | { | 
| 43 | 281 |  |  |  |  | 453 | my @op=split(/_/,$name,2); | 
| 44 | 81 |  |  | 81 |  | 318 | no strict 'refs'; ## no critic (ProhibitNoStrict) | 
|  | 81 |  |  |  |  | 82 |  | 
|  | 81 |  |  |  |  | 5257 |  | 
| 45 | 281 |  |  | 0 |  | 570 | *{"${class}::${name}"}=sub { my $self=shift; Net::DRI::Exception->die(0,'DRD',4,sprintf('No operation %s %s available for registry %s',@op,$self->name())); }; | 
|  | 281 |  |  |  |  | 992 |  | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 46 |  |  |  |  |  |  | } | 
| 47 | 81 |  |  | 81 |  | 930 | no strict 'refs'; ## no critic (ProhibitNoStrict) | 
|  | 81 |  |  |  |  | 82 |  | 
|  | 81 |  |  |  |  | 10701 |  | 
| 48 | 29 |  |  | 0 |  | 81 | *{"${class}::unavailable_operations"}=sub { return @methods; }; | 
|  | 29 |  |  |  |  | 101 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 49 | 29 |  |  |  |  | 76 | return; | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | #################################################################################################### | 
| 53 |  |  |  |  |  |  | ## OBJECT METHODS | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | sub generate_trid | 
| 56 |  |  |  |  |  |  | { | 
| 57 | 10 |  |  | 10 | 0 | 10 | my ($self,$name)=@_; | 
| 58 | 10 | 50 |  |  |  | 13 | if (! defined $name) { $name=$self->name(); } | 
|  | 10 |  |  |  |  | 21 |  | 
| 59 | 10 |  |  |  |  | 38 | return $self->trid_factory()->($name); | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 3 |  |  | 3 | 0 | 7 | sub log_setup_channel { my ($self,@r)=@_; $self->logging()->setup_channel(@r); return; } | 
|  | 3 |  |  |  |  | 11 |  | 
|  | 3 |  |  |  |  | 4 |  | 
| 63 | 512 | 50 |  | 512 | 0 | 885 | sub log_output        { my ($self,@r)=@_; $self->logging()->output(@r) if $self->logging(); return; } | 
|  | 512 |  |  |  |  | 1529 |  | 
|  | 512 |  |  |  |  | 869 |  | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | #################################################################################################### | 
| 66 |  |  |  |  |  |  | 1; | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | __END__ |