OOP.pm

filter: Statementstmt 47.5% 19 / 40 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 45.2% 24 / 53 CC 4 SCAR 20.2
CC
4
Cov
41%
_init
15.7
BEGIN
1.0
BEGIN
1.0
CRAP 7.5
« OOP/_getArgs.pm ↑ Summary OOP/Constructor.pm »
1 package OOP;
2  
3 1 ▶use OOP::Constructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use OOP::Accessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 @ISA = qw(OOP::Constructor OOP::Accessor);
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 #***************************************************************************
10 ############################################################################
11 #*[OOP]*********************************************************************
12 #
13 # Author : Milan Adamovsky
14 # Date : 01/14/2008
15 # Updated : 04/03/2008
16 #
17 # Version : 1.01
18 #
19 # Copyright 2007-Present Milan Adamovsky. All rights reserved.
20 # It may be used and modified freely, but I do request that this copyright
21 # notice remain attached to the file. You may modify this module as you
22 # wish, but if you redistribute a modified version, please attach a note
23 # listing the modifications you have made.
24 #
25 # Purpose : This class (module) provides a developer with various methods
26 # that enforce uniform OOP conventions and ensure sound OOP
27 # development in PERL.
28 #
29 # Usage : For a full detailed usage of this class, please refer to the
30 # POD found attached below. To read it simply type the command
31 # 'perldoc OOP' at the command-prompt or simply scroll down.
32 #
33 # History : 04/03/2008 - Version 1.01
34 # Fixed logic that if a dataType is a hash with a writeAccess
35 # of '1', that any elements not specified in the value can be
36 # added dynamically and do not have to be explicitly specified.
37 # Added missing EXISTS to _getArgs.pm
38 #
39 #***************************************************************************
40  
41 1 $OOP::VERSION='1.01';
42  
43 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
44  
45 4 my ($class, $ARGS) = (@_);
46
47 4 my $self = bless {}, $class;
48  
49 4 $self->{PROPERTIES} = $self->set_args($ARGS);
50  
51 4 return $self;
52
53 }
54  
55 #***************************************************************************
56 #*[_init]*******************************************************************
57 # PLACEHOLDER FOR FUTURE . NOT USED UNTIL THIS NOTICE IS REMOVED!
58 sub _init
59 0 ▶{
Subroutine _init: not called CC=4 SCAR=27.5
60  
61 1 ▶ no strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 0 my ($self, $ARGS) = @_;
64  
65 0 my $caller = $ARGS->{caller};
66 0 my $callerPkg = ref $ARGS->{caller};
67 0 my $pluginFolder = "./$callerPkg/Core";
68  
69 0 my $obj;
70  
71 0 opendir(COMPONENTS, $pluginFolder);
72 0 my @files = readdir(COMPONENTS);
73 0 closedir(COMPONENTS);
74  
75 map {
76 0 /(.*)\.pm/;
77 0 my $cpy = $1;
78  
79 0 ▶ if ($cpy)
Branch: 1 branch
BranchTrueFalseTotal
if ($cpy) 0 0 0
80 {
81 0 ▶ ($cpy->use && print "Loading " . $cpy . " version ");
Branch: 1 branch
BranchTrueFalseTotal
$cpy->use and print 'Loading ' . $cpy . ' version ' 0 0 0
82 0 $obj = $cpy->new($caller);
83
84 0 ▶ if ($obj->{inherit})
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->{"inherit"}) 0 0 0
85 {
86 0 push(@$callerPkg::ISA, $cpy)
87 }
88
89 0 $caller->{CORE}->{$cpy} = $obj;
90
91 0 print ${$cpy.'::VERSION'} . "... ";
92 0 print "Ok.\n";
93 }
94 } @files;
95  
96 0 return();
97  
98 }
99  
100 1 1;
101
102 __END__
« OOP/_getArgs.pm ↑ Summary OOP/Constructor.pm »