DWH_File/Registry/URI.pm

filter: Statementstmt 97.6% 41 / 42 Branchbran 100% 4 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 90.9% 10 / 11 Podpod 0.0% 0 / 6 totaltotal 82.3% 56 / 68 CC 4 SCAR 4.1
CC
4
Cov
94%
new
2.0
retrieve
2.0
tag
2.0
CRAP 1.5
« DWH_File/Reference.pm ↑ Summary DWH_File/Cache.pm »
1 package DWH_File::Registry::URI;
2  
3 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use vars qw( @ISA $VERSION %registrands );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use DWH_File::Registry;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 9 @ISA = qw( DWH_File::Registry );
9 9 $VERSION = 0.01;
10  
11 9 ▶BEGIN { %registrands = () }
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 13 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
Pod undocumented
14 13 my ( $this, $kernel, $property ) = @_;
15 13 ▶ my $class = ref $this || $this;
Condition33%1/3
ref $this || $this
l!l&&r!l&&!r
0130
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table33%1/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
16 13 my $self = $class->SUPER::new( $kernel, $property );
17 13 $self->{ tags } = {};
18 13 $self->register( $kernel );
19 13 return $self;
20 }
21  
22 19 ▶sub retrieve {
Subroutine retrieve: called CC=2 SCAR=6.9
Pod undocumented
23 19 my ( $self, $tag ) = @_;
24 19 ▶ if ( exists $self->{ $tag } ) { return $self->{ $tag } }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{$tag}) { } 17 2 19
25 else {
26 2 my $uri = $self->fetch( $tag );
27 2 my $registrand = $registrands{ $uri };
28 2 $self->{ tags }{ $uri } = $tag;
29 2 $self->{ $tag } = $registrand;
30 2 return $registrand;
31 }
32 }
33  
34 26 ▶sub register {
Subroutine register: called CC=1 SCAR=0.0
Pod undocumented
35 26 my ( $self, $registrand ) = @_;
36 26 $registrands{ $registrand->uri } = $registrand;
37 }
38  
39 21 ▶sub tag {
Subroutine tag: called CC=2 SCAR=6.9
Pod undocumented
40 21 my ( $self, $registrand ) = @_;
41 21 my $uri = $registrand->uri;
42 21 ▶ if ( exists $self->{ tags }{ $uri } ) { return $self->{ tags }{ $uri } }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'tags'}{$uri}) { } 19 2 21
43 else {
44 2 my $tag = $self->get_key( $uri );
45 2 $self->{ tags }{ $uri } = $tag;
46 2 $self->{ $tag } = $registrand;
47 2 return $tag;
48 }
49 }
50  
51 13 ▶sub release {
Subroutine release: called CC=1 SCAR=0.0
Pod undocumented
52 13 my ( $self, $registrand ) = @_;
53 #for my $registry ( @instances ) { $registry->sign_out( $registrand ) }
54 }
55  
56 0 ▶sub sign_out {
Subroutine sign_out: not called CC=1 SCAR=6.9
Pod undocumented
57 0 my ( $self, $registrand ) = @_;
58 #delete $self->{ tags }{ $registrand->uri };
59 }
60  
61 9 1;
62  
63 __END__
« DWH_File/Reference.pm ↑ Summary DWH_File/Cache.pm »