blib/lib/UUID.pm

filter: Statementstmt 98.0% 51 / 52 Branchbran 93.7% 15 / 16 Conditioncond 83.3% 15 / 18 MC/DCmcdc 75.0% 9 / 12 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 92.2% 95 / 103 CC 15 SCAR 25.0
CC
15
Cov
94%
import
15.1
BEGIN
1.0
BEGIN
1.0
CRAP 12.1
↑ Summary ulib/sysrand.c »
1 package UUID;
2 204 require 5.005063; # see MIN_PERL_VERSION in Makefile.PL
3 204 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 204 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 204 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 204 require Exporter;
8 204 require DynaLoader;
9  
10 204 ▶use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 204 @ISA = qw(DynaLoader);
12  
13 204 $VERSION = '0.40';
14  
15 204 %EXPORT_TAGS = (
16 'all' => [qw(
17 &clear &compare &copy &generate &generate_random &generate_time
18 &generate_v0 &generate_v1 &generate_v3 &generate_v4 &generate_v5
19 &generate_v6 &generate_v7 &is_null &parse &time &type &unparse
20 &unparse_lower &unparse_upper &uuid &uuid0 &uuid1 &uuid3 &uuid4
21 &uuid5 &uuid6 &uuid7 &variant &version
22 )],
23 );
24  
25 204 @EXPORT_OK = @{$EXPORT_TAGS{'all'}};
26  
27 204 bootstrap UUID $VERSION;
28  
29 185 ▶sub import {
Subroutine import: called CC=15 SCAR=27.2
30 185 ▶ for (my $i=scalar(@_)-1 ; $i>0 ; --$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i > 0) 243 183 426
31 243 my $v = $_[$i];
32 243 chomp $v;
33 # :persist=FOO
34 243 ▶ if (length($v) > 8 and substr($v,0,8) eq ':persist') {
Branch: 1 branch
BranchTrueFalseTotal
if (length $v > 8 and substr($v, 0, 8) eq ":persist") 7 236 243
Condition100%3/3
length $v > 8 and substr($v, 0, 8) eq ":persist"
!ll&&!rl&&r
206307
MC/DC100%2/2
length $v > 8 and substr($v, 0, 8) eq ":persist"
length $v > 8 substr($v, 0, 8) eq ":persist"
Truth table100%3/3
A and B
A= length $v > 8B= substr($v, 0, 8) eq ":persist"
ABresult
0X0
100
111
35 7 my $arg = substr $v, 8;
36 7 ▶ if (length($arg) < 2 or substr($arg, 0, 1) ne '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (length $arg < 2 or substr($arg, 0, 1) ne "=") 0 7 7
Condition33%1/3
length $arg < 2 or substr($arg, 0, 1) ne "="
l!l&&r!l&&!r
007
MC/DC0%0/2
length $arg < 2 or substr($arg, 0, 1) ne "="
length $arg < 2 substr($arg, 0, 1) ne "="
Truth table33%1/3
A or B
A= length $arg < 2B= substr($arg, 0, 1) ne "="
ABresult
1X1
011
000
37 0 croak "Usage: :persist=FILE";
38 }
39 7 my $file = substr $arg, 1;
40 7 _persist($file);
41 7 splice @_, $i, 1;
42 7 next;
43 }
44 # :mac=random
45 236 ▶ if (length($v) == 11 and $v eq ':mac=random') {
Branch: 1 branch
BranchTrueFalseTotal
if (length $v == 11 and $v eq ":mac=random") 8 228 236
Condition100%3/3
length $v == 11 and $v eq ":mac=random"
!ll&&!rl&&r
212168
MC/DC100%2/2
length $v == 11 and $v eq ":mac=random"
length $v == 11 $v eq ":mac=random"
Truth table100%3/3
A and B
A= length $v == 11B= $v eq ":mac=random"
ABresult
0X0
100
111
46 8 _hide_mac();
47 8 splice @_, $i, 1;
48 8 next;
49 }
50 # :mac=unique
51 228 ▶ if (length($v) == 11 and $v eq ':mac=unique') {
Branch: 1 branch
BranchTrueFalseTotal
if (length $v == 11 and $v eq ":mac=unique") 2 226 228
Condition100%3/3
length $v == 11 and $v eq ":mac=unique"
!ll&&!rl&&r
212142
MC/DC100%2/2
length $v == 11 and $v eq ":mac=unique"
length $v == 11 $v eq ":mac=unique"
Truth table100%3/3
A and B
A= length $v == 11B= $v eq ":mac=unique"
ABresult
0X0
100
111
52 2 _hide_always();
53 2 splice @_, $i, 1;
54 2 next;
55 }
56 # :defer[=N]
57 226 ▶ if (length($v) >= 6 and substr($v,0,6) eq ':defer') {
Branch: 1 branch
BranchTrueFalseTotal
if (length $v >= 6 and substr($v, 0, 6) eq ":defer") 6 220 226
Condition100%3/3
length $v >= 6 and substr($v, 0, 6) eq ":defer"
!ll&&!rl&&r
174466
MC/DC100%2/2
length $v >= 6 and substr($v, 0, 6) eq ":defer"
length $v >= 6 substr($v, 0, 6) eq ":defer"
Truth table100%3/3
A and B
A= length $v >= 6B= substr($v, 0, 6) eq ":defer"
ABresult
0X0
100
111
58 6 my $arg = substr $v, 6;
59 6 my $len = length $arg;
60 6 ▶ if ($len == 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($len == 0) { } 1 5 6
elsif ($len == 1 or substr($arg, 0, 1) ne '=') { } 1 4 5
61 1 $arg = '=0.001';
62 }
63 ▶ elsif ($len == 1 or substr($arg, 0, 1) ne '=') {
Condition66%2/3
$len == 1 or substr($arg, 0, 1) ne "="
l!l&&r!l&&!r
104
MC/DC50%1/2
$len == 1 or substr($arg, 0, 1) ne "="
$len == 1 substr($arg, 0, 1) ne "="
Truth table66%2/3
A or B
A= $len == 1B= substr($arg, 0, 1) ne "="
ABresult
1X1
011
000
64 1 croak "Usage: :defer[=N]";
65 }
66 5 my $val = substr $arg, 1;
67 5 _defer($val);
68 4 splice @_, $i, 1;
69 4 next;
70 }
71 }
72 183 goto &Exporter::import;
73 }
74  
75 # Preloaded methods go here.
76  
77 204 1;
78 __END__
↑ Summary ulib/sysrand.c »