Typed/Hash.pm

filter: Statementstmt 40.3% 21 / 52 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 6 / 14 Podpod n/a totaltotal 40.9% 27 / 66 CC 1 SCAR 4.5
CC
1
Cov
40%
STORE
2.0
FETCH
2.0
FIRSTKEY
2.0
CRAP 1.6
« Typed/Code.pm ↑ Summary Typed/Scalar.pm »
1 package Variable::Strongly::Typed::Hash;
2  
3 8 ▶use version; $VERSION = qv('1.0.0');
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 ▶use base qw(Variable::Strongly::Typed);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 {
12 1 ▶ sub TIEHASH {
Subroutine TIEHASH: called CC=1 SCAR=0.0
13 1 my($class, $type) = @_;
14  
15 1 my $self = bless \my($anon_scalar), $class;
16 1 $self->_init({}, $type);
17 }
18  
19 0 ▶ sub STORE {
Subroutine STORE: not called CC=1 SCAR=6.9
20 0 my($self, $key, $value) = @_;
21 0 my $hash = $self->_get_object;
22  
23 0 $self->_check_values($value);
24 0 $hash->{$key} = $value;
25 }
26  
27 0 ▶ sub FETCH {
Subroutine FETCH: not called CC=1 SCAR=6.9
28 0 my($self, $key) = @_;
29 0 my $hash = $self->_get_object;
30 0 $hash->{$key};
31 }
32  
33 0 ▶ sub FIRSTKEY {
Subroutine FIRSTKEY: not called CC=1 SCAR=6.9
34 0 my($self) = @_;
35 0 my $hash = $self->_get_object;
36 0 my $a = scalar keys %{$hash};
37 0 each %{$hash};
38 }
39  
40 0 ▶ sub NEXTKEY {
Subroutine NEXTKEY: not called CC=1 SCAR=6.9
41 0 my($self) = @_;
42 0 my $hash = $self->_get_object;
43 0 each %{$hash};
44 }
45  
46 0 ▶ sub EXISTS {
Subroutine EXISTS: not called CC=1 SCAR=6.9
47 0 my($self, $key) = @_;
48 0 my $hash = $self->_get_object;
49 0 exists $hash->{$key};
50 }
51  
52 0 ▶ sub DELETE {
Subroutine DELETE: not called CC=1 SCAR=6.9
53 0 my($self, $key) = @_;
54 0 my $hash = $self->_get_object;
55 0 delete $hash->{$key};
56 }
57  
58 0 ▶ sub CLEAR {
Subroutine CLEAR: not called CC=1 SCAR=6.9
59 0 my($self) = @_;
60 0 my $hash = $self->_get_object;
61 0 %{$hash} = ()
62 }
63  
64 0 ▶ sub SCALAR {
Subroutine SCALAR: not called CC=1 SCAR=6.9
65 0 my($self) = @_;
66 0 my $hash = $self->_get_object;
67 0 scalar %{$hash};
68 }
69  
70 }
71  
72 8 1;
73  
74 __END__
« Typed/Code.pm ↑ Summary Typed/Scalar.pm »