Trace/Chunk.pm

filter: Statementstmt 95.8% 46 / 48 Branchbran 75.0% 3 / 4 Conditioncond 75.0% 3 / 4 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 84.6% 11 / 13 Podpod 87.5% 7 / 8 totaltotal 89.8% 71 / 79 CC 4 SCAR 3.6
CC
4
Cov
93%
new
2.0
keys
2.0
value
2.0
CRAP 1.4
« Trace/Utils.pm ↑ Summary
1 #
2 # $Id: Chunk.pm,v 1.10 2003/12/24 20:38:54 oratrc Exp $
3 #
4 package Oracle::Trace::Chunk;
5  
6 1 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Oracle::Trace::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our @ISA = qw(Oracle::Trace::Utils);
13  
14 1 our $VERSION = do { my @r = (q$Revision: 1.10 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
15  
16 1 ▶my $DEBUG = $ENV{Oracle_Trace_DEBUG} || 0;
Condition50%1/2
$ENV{'Oracle_Trace_DEBUG'} || 0
l!l
01
MC/DC0%0/1
$ENV{'Oracle_Trace_DEBUG'} || 0
$ENV{'Oracle_Trace_DEBUG'}
Truth table50%1/2
A
A= $ENV{'Oracle_Trace_DEBUG'}
Aresult
11
00
17  
18 =item new
19  
20 Create a new object.
21  
22 my $o_chk = Oracle::Trace::Chunk->new();
23  
24 =cut
25  
26 27 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod documented
27 27 my $proto = shift;
28 27 ▶ my $class = ref($proto) ? ref($proto) : $proto;
Branch: 1 branch
BranchTrueFalseTotal
ref $proto ? : 0 27 27
29 27 my $self = bless({
30 _data => {},
31 _id => '',
32 _parent => 0,
33 _child => 0,
34 @_}, $class);
35 27 $self->init;
36 27 return $self;
37 }
38  
39 =item init
40  
41 Initialise a C<Chunk>, set the oid:
42  
43 $o_chk->parse;
44  
45 =cut
46  
47 27 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
48 27 my $self = shift;
49 27 my $xref = $self;
50 27 my $x = $xref;
51 27 $x =~ s/^(\w+:+)+//;
52 27 $x = substr($x, 0, 1);
53 27 $xref =~ s/^\w+(?::+\w+)*=[A-Z]+\(//;
54 27 $xref =~ s/\)$//;
55 27 $self->{_id} = join('-', $$, $x, $xref);
56 27 return $self;
57 }
58  
59 =item oid
60  
61 Return the id of this object.
62  
63 my $oid = $o_chk->oid;
64  
65 =cut
66  
67 1 ▶sub oid {
Subroutine oid: called CC=1 SCAR=0.0
Pod documented
68 1 my $self = shift;
69 1 return $self->{_id};
70 }
71  
72 =item parse
73  
74 Parse the given string appropriately, expecting to be overriden.
75  
76 Returns the object
77  
78 $o_chk->parse($string);
79  
80 =cut
81  
82 0 ▶sub parse {
Subroutine parse: not called CC=1 SCAR=0.0
Pod documented
83 # supplied by each relevant package
84 }
85  
86 =item keys
87  
88 Return an array of object data keys, restricted by optional regex.
89  
90 my @keys = $o_chk->keys($regex);
91  
92 =cut
93  
94 36 ▶sub keys {
Subroutine keys: called CC=2 SCAR=6.9
Pod documented
95 36 my $self = shift;
96 36 ▶ my $arg = shift || '';
Condition100%2/2
shift() || ''
l!l
234
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
97 36 return grep(/$arg/, keys %{$self->{_data}});
98 }
99  
100 =item value
101  
102 Return the value(s) for the given key.
103  
104 my ($val/s) = $o_chk->value($key);
105  
106 =cut
107  
108 4 ▶sub value {
Subroutine value: called CC=2 SCAR=6.9
Pod documented
109 4 my $self = shift;
110 4 my $key = shift;
111 4 ▶ return defined($self->{_data}{$key}) ? @{$self->{_data}{$key}} : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'_data'}{$key} ? : 3 1 4
112 }
113  
114 =item statement
115  
116 Return statement/s for an entry:
117  
118 my $s_stmt = $o_ent->statement;
119  
120 =cut
121  
122 4 ▶sub statement {
Subroutine statement: called CC=1 SCAR=0.0
Pod documented
123 4 my $self = shift;
124  
125 4 return $self->values('type'=>'other');
126 }
127  
128 0 ▶sub dump {
Subroutine dump: not called CC=1 SCAR=6.9
Pod undocumented
129 0 my $self = shift;
130 0 return Dumper($self->{_data});
131 };
132  
133 1 1;
134 __END__
« Trace/Utils.pm ↑ Summary