blib/lib/Data/AutoBimap.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 95.4% 42 / 44 CC 3 SCAR 3.7
CC
3
Cov
97%
new
2.0
s2n
2.0
BEGIN
1.0
CRAP 1.4
↑ Summary
1 package Data::AutoBimap;
2
3 3 ▶use 5.012000;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 3 our $VERSION = '0.03';
9
10 3 our %EXPORT_TAGS = ( 'all' => [ qw(
11
12 ) ] );
13
14 3 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
15
16 3 our @EXPORT = qw(
17 );
18
19 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod documented
20 1 my ($class, %options) = @_;
21
22 1 ▶ $options{start} //= 1;
Condition50%1/2
$options{"start"} //= 1
l!l
01
MC/DC0%0/1
$options{"start"} //= 1
$options{"start"}
Truth table50%1/2
A
A= $options{"start"}
Aresult
11
00
23
24 my $self = {
25 next => $options{start},
26 1 s2n => {},
27 n2s => [],
28 };
29
30 1 bless $self, $class;
31 }
32
33 3 ▶sub s2n {
Subroutine s2n: called CC=2 SCAR=6.9
Pod documented
34 3 my ($self, $s) = @_;
35
36 3 ▶ unless (exists $self->{s2n}{$s}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"s2n"}{$s}) 2 1 3
37 2 $self->{s2n}{$s} = $self->{next};
38 2 $self->{n2s}[$self->{next}] = $s;
39 2 $self->{next}++;
40 }
41
42 3 return $self->{s2n}{$s};
43 }
44
45 2 ▶sub n2s {
Subroutine n2s: called CC=1 SCAR=0.0
Pod documented
46 2 my ($self, $n) = @_;
47 2 return $self->{n2s}[$n];
48 }
49
50 3 1;
51
52 __END__
↑ Summary