DRI/BaseClass.pm

filter: Statementstmt 75.5% 37 / 49 Branchbran 25.0% 1 / 4 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 64.2% 9 / 14 Podpod 0.0% 0 / 5 totaltotal 59.7% 49 / 82 CC 7 SCAR 8.4
CC
7
Cov
68%
generate_trid
6.0
make_exception_if_not_implemented
3.2
make_exception_for_unavailable_operations
3.1
CRAP 2.3
« DRI/DRD/Domicilium.pm ↑ Summary DRI/DRD/TELEGreenland.pm »
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 94 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 94 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 94 ▶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 {
27 168 ▶ my ($self,@methods)=@_;
Subroutine make_exception_if_not_implemented: called CC=3 SCAR=11.7
Pod undocumented
28 168 ▶ my $class=ref $self || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
01680
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
29 168 foreach my $name (@methods)
30 {
31 94 ▶ no strict 'refs'; ## no critic (ProhibitNoStrict)
Subroutine BEGIN: called CC=1 SCAR=0.0
32 768 ▶ *{"${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 168 return;
35 }
36  
37 sub make_exception_for_unavailable_operations
38 {
39 32 ▶ my ($self,@methods)=@_;
Subroutine make_exception_for_unavailable_operations: called CC=3 SCAR=11.4
Pod undocumented
40 32 ▶ my $class=ref $self || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
0320
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
41 32 foreach my $name (@methods)
42 {
43 293 my @op=split(/_/,$name,2);
44 94 ▶ no strict 'refs'; ## no critic (ProhibitNoStrict)
Subroutine BEGIN: called CC=1 SCAR=0.0
45 293 ▶ *{"${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 94 ▶ no strict 'refs'; ## no critic (ProhibitNoStrict)
Subroutine BEGIN: called CC=1 SCAR=0.0
48 32 ▶ *{"${class}::unavailable_operations"}=sub { return @methods; };
Subroutine __ANON__: not called CC=1 SCAR=0.4
49 32 return;
50 }
51  
52 ####################################################################################################
53 ## OBJECT METHODS
54  
55 sub generate_trid
56 {
57 0 ▶ my ($self,$name)=@_;
Subroutine generate_trid: not called CC=2 SCAR=17.9
Pod undocumented
58 0 ▶ if (! defined $name) { $name=$self->name(); }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $name) 0 0 0
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 473 ▶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
BranchTrueFalseTotal
if $self->logging 473 0 473
64  
65 ####################################################################################################
66 94 1;
67  
68 __END__
69  
70 =pod
71  
72 =head1 NAME
73  
74 Net::DRI::BaseClass - Superclass of various classes inside Net::DRI
75  
76 =head1 SYNOPSIS
77  
78 Not directly used by users, this is a purely internal class, never visible to the outside of Net::DRI.
79  
80 =head1 DESCRIPTION
81  
82 This is the superclass of some Net::DRI classes, providing various useful functions.
83  
84 =head1 EXAMPLES
85  
86 No user examples.
87  
88 =head1 SUBROUTINES/METHODS
89  
90 This is mostly a pure virtual superclass.
91  
92 =head1 DIAGNOSTICS
93  
94 None.
95  
96 =head1 CONFIGURATION AND ENVIRONMENT
97  
98 None.
99  
100 =head1 DEPENDENCIES
101  
102 This modules has to be used inside the Net::DRI framework and needs the following composants:
103  
104 =over
105  
106 =item L<Net::DRI::Exception>
107  
108 =back
109  
110 =head1 INCOMPATIBILITIES
111  
112 None
113  
114 =head1 BUGS AND LIMITATIONS
115  
116 No known bugs. Please report problems to author (see below) or use CPAN RT system. Patches are welcome.
117  
118 This should probably be better done with Moose and roles. It would however require a major overhaul
119 to everything inside Net::DRI, so this would probably not happen very soon, maybe with a Perl6 port.
120  
121 This class was introduced very late in Net::DRI, multiple parts of this framework should be
122 modified to take advantage of this class.
123  
124 =head1 SUPPORT
125  
126 For now, support questions should be sent to:
127  
128 E<lt>netdri@dotandco.comE<gt>
129  
130 Please also see the SUPPORT file in the distribution.
131  
132 =head1 SEE ALSO
133  
134 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
135  
136 =head1 AUTHOR
137  
138 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
139  
140 =head1 LICENSE AND COPYRIGHT
141  
142 Copyright (c) 2009-2010,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
143  
144 This program is free software; you can redistribute it and/or modify
145 it under the terms of the GNU General Public License as published by
146 the Free Software Foundation; either version 2 of the License, or
147 (at your option) any later version.
148  
149 See the LICENSE file that comes with this distribution for more details.
150  
151 =cut
« DRI/DRD/Domicilium.pm ↑ Summary DRI/DRD/TELEGreenland.pm »