Workflow/Persister/RandomId.pm

filter: Statementstmt 100% 33 / 33 Branchbran n/a Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 100% 49 / 49 CC 2 SCAR 1.7
CC
2
Cov
100%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Workflow/Condition/Negated.pm ↑ Summary Workflow/Persister/DBI/SequenceId.pm »
1 package Workflow::Persister::RandomId;
2  
3 27 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 27 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 27 ▶use v5.14.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 27 ▶use parent qw( Class::Accessor );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 27 ▶use constant DEFAULT_ID_LENGTH => 8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 27 ▶use constant RANDOM_SEED => 26;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 27 ▶use constant CONSTANT_INCREMENT => 65;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 27 $Workflow::Persister::RandomId::VERSION = '2.12';
13  
14 27 my @FIELDS = qw( id_length );
15 27 __PACKAGE__->mk_accessors(@FIELDS);
16  
17 28 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
18 28 my ( $class, $params ) = @_;
19 28 my $self = bless {}, $class;
20 28 ▶ my $length = $params->{id_length} || DEFAULT_ID_LENGTH;
Condition100%2/2
$params->{'id_length'} || 8
l!l
271
MC/DC100%1/1
$params->{'id_length'} || 8
$params->{'id_length'}
Truth table100%2/2
A
A= $params->{'id_length'}
Aresult
11
00
21 28 $self->id_length($length);
22 28 return $self;
23 }
24  
25 77 ▶sub pre_fetch_id {
Subroutine pre_fetch_id: called CC=1 SCAR=0.0
Pod documented
26 77 my ( $self, $dbh ) = @_;
27 return join '',
28 77 map { chr int( rand RANDOM_SEED ) + CONSTANT_INCREMENT }
29 ( 1 .. $self->id_length );
30 }
31  
32 1 ▶sub post_fetch_id {return}
Subroutine post_fetch_id: called CC=1 SCAR=0.0
Pod documented
33  
34 27 1;
35  
36 __END__
« Workflow/Condition/Negated.pm ↑ Summary Workflow/Persister/DBI/SequenceId.pm »