blib/lib/NG/SHashtable.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 9 | 19 | 47.3 |
branch | n/a | ||
condition | n/a | ||
subroutine | 3 | 7 | 42.8 |
pod | 0 | 2 | 0.0 |
total | 12 | 28 | 42.8 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package SHashtable; | ||||||
2 | |||||||
3 | 1 | 1 | 6 | use strict; | |||
1 | 2 | ||||||
1 | 35 | ||||||
4 | 1 | 1 | 5 | use warnings; | |||
1 | 2 | ||||||
1 | 8192 | ||||||
5 | 1 | 1 | 15 | use base qw(Hashtable); | |||
1 | 2 | ||||||
1 | 671 | ||||||
6 | |||||||
7 | sub new { | ||||||
8 | 0 | 0 | 0 | my $pkg = shift; | |||
9 | 0 | my $hash = {@_}; | |||||
10 | 0 | return bless $hash, $pkg; | |||||
11 | } | ||||||
12 | |||||||
13 | sub each { | ||||||
14 | 0 | 0 | 0 | my ( $self, $sub ) = @_; | |||
15 | $self->keys->sort( | ||||||
16 | sub { | ||||||
17 | 0 | 0 | my ( $a, $b ) = @_; | ||||
18 | 0 | return $a cmp $b; | |||||
19 | } | ||||||
20 | )->each( | ||||||
21 | sub { | ||||||
22 | 0 | 0 | my ($key) = @_; | ||||
23 | 0 | $sub->( $key, $self->get($key) ); | |||||
24 | } | ||||||
25 | 0 | ); | |||||
26 | 0 | return $self; | |||||
27 | } | ||||||
28 | |||||||
29 | 1; |