line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hashtable; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
13
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw(Object); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
90
|
|
6
|
1
|
|
|
1
|
|
6
|
use Array; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
376
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
0
|
|
|
0
|
0
|
|
my $pkg = shift; |
10
|
0
|
|
|
|
|
|
my $hash = {@_}; |
11
|
0
|
|
|
|
|
|
return bless $hash, $pkg; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub put { |
15
|
0
|
|
|
0
|
0
|
|
my ( $self, $key, $val ) = @_; |
16
|
0
|
|
|
|
|
|
$self->{$key} = $val; |
17
|
0
|
|
|
|
|
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub get { |
21
|
0
|
|
|
0
|
0
|
|
my ( $self, $key ) = @_; |
22
|
0
|
|
|
|
|
|
return $self->{$key}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub keys { |
26
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
27
|
0
|
|
|
|
|
|
return new Array( keys %$self ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub values { |
31
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
32
|
0
|
|
|
|
|
|
return new Array( values %$self ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub remove { |
36
|
0
|
|
|
0
|
0
|
|
my ( $self, $key ) = @_; |
37
|
0
|
|
|
|
|
|
delete $self->{$key}; |
38
|
0
|
|
|
|
|
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub each { |
42
|
0
|
|
|
0
|
0
|
|
my ( $self, $sub ) = @_; |
43
|
|
|
|
|
|
|
$self->keys->each( |
44
|
|
|
|
|
|
|
sub { |
45
|
0
|
|
|
0
|
|
|
my ($key) = @_; |
46
|
0
|
|
|
|
|
|
$sub->( $key, $self->get($key) ); |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
); |
49
|
0
|
|
|
|
|
|
return $self; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |