line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
951
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Code::Statistics::Metric::sdepth; |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$Code::Statistics::Metric::sdepth::VERSION = '1.112980'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: measures the scope depth of a target |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
extends 'Code::Statistics::Metric'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub measure { |
16
|
76
|
|
|
76
|
1
|
141
|
my ( $class, $target ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
76
|
|
|
|
|
239
|
my @parent_list = $class->_get_parents( $target ); |
19
|
|
|
|
|
|
|
|
20
|
76
|
|
|
|
|
164
|
my $depth = @parent_list - 1; |
21
|
|
|
|
|
|
|
|
22
|
76
|
|
|
|
|
575
|
return $depth; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _get_parents { |
26
|
330
|
|
|
330
|
|
483
|
my ( $class, $target ) = @_; |
27
|
330
|
|
|
|
|
873
|
my $parent = $target->parent; |
28
|
330
|
100
|
|
|
|
2024
|
return $target if !$parent; |
29
|
254
|
|
|
|
|
614
|
return ( $target, $class->_get_parents( $parent ) ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
=pod |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Code::Statistics::Metric::sdepth - measures the scope depth of a target |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 VERSION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
version 1.112980 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 measure |
46
|
|
|
|
|
|
|
Returns the scope depth of the given target. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 AUTHOR |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Christian Walde <mithaldu@yahoo.de> |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This software is Copyright (c) 2010 by Christian Walde. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This is free software, licensed under: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE, Version 2, December 2004 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|