| 1 | ## Domain Registry Interface, Superclass of various classes for Net::DRI | ||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||
| 3 | ## Copyright (c) 2009-2010,2013 Patrick Mevzek <netdri@dotandco.com>. 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 | 93 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 93 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 93 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | #################################################################################################### | ||||||||||||||||||||
| 23 | ## CLASS METHODS | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | sub make_exception_if_not_implemented | ||||||||||||||||||||
| 26 | 164 | ▶ | { | ||||||||||||||||||
|
Subroutine
make_exception_if_not_implemented: called CC=3 SCAR=11.7
Pod
undocumented
| |||||||||||||||||||||
| 27 | 164 | my ($self,@methods)=@_; | |||||||||||||||||||
| 28 | 164 | ▶ | my $class=ref $self || $self; | ||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 29 | 164 | foreach my $name (@methods) | |||||||||||||||||||
| 30 | { | ||||||||||||||||||||
| 31 | 93 | ▶ | no strict 'refs'; ## no critic (ProhibitNoStrict) | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | 0 | ▶ | *{"${class}::${name}"}=sub { my $self=shift; Net::DRI::Exception->die(1,'internal',1,sprintf('Method %s not implemented in %s, please report.',$name,$class)); }; | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | 164 | return; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | sub make_exception_for_unavailable_operations | ||||||||||||||||||||
| 38 | 31 | ▶ | { | ||||||||||||||||||
|
Subroutine
make_exception_for_unavailable_operations: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||
| 39 | 31 | my ($self,@methods)=@_; | |||||||||||||||||||
| 40 | 31 | ▶ | my $class=ref $self || $self; | ||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 41 | 31 | foreach my $name (@methods) | |||||||||||||||||||
| 42 | { | ||||||||||||||||||||
| 43 | 289 | my @op=split(/_/,$name,2); | |||||||||||||||||||
| 44 | 93 | ▶ | no strict 'refs'; ## no critic (ProhibitNoStrict) | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 45 | 0 | ▶ | *{"${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())); }; | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | 93 | ▶ | no strict 'refs'; ## no critic (ProhibitNoStrict) | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 48 | 0 | ▶ | *{"${class}::unavailable_operations"}=sub { return @methods; }; | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||||||||||||||||||||
| 49 | 31 | return; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | #################################################################################################### | ||||||||||||||||||||
| 53 | ## OBJECT METHODS | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | sub generate_trid | ||||||||||||||||||||
| 56 | 0 | ▶ | { | ||||||||||||||||||
|
Subroutine
generate_trid: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 57 | 0 | my ($self,$name)=@_; | |||||||||||||||||||
| 58 | 0 | ▶ | if (! defined $name) { $name=$self->name(); } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 59 | 0 | return $self->trid_factory()->($name); | |||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 0 | ▶ | sub log_setup_channel { my ($self,@r)=@_; $self->logging()->setup_channel(@r); return; } | ||||||||||||||||||
|
Subroutine
log_setup_channel: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 63 | 467 | ▶ | sub log_output { my ($self,@r)=@_; $self->logging()->output(@r) if $self->logging(); return; } | ||||||||||||||||||
|
Subroutine
log_output: called CC=2 SCAR=7.1
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | #################################################################################################### | ||||||||||||||||||||
| 66 | 93 | 1; | |||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | __END__ | ||||||||||||||||||||