lib/Myriad/Util/UUID.pm

filter: Statementstmt 85.7% 12 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 78.9% 15 / 19 CC 1 SCAR 2.2
CC
1
Cov
86%
uuid
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« lib/Myriad/Example/Startup.pm ↑ Summary lib/Myriad/API.pm »
1 package Myriad::Util::UUID;
2  
3 17 our $VERSION = '1.001'; # VERSION
4 17 our $AUTHORITY = 'cpan:DERIV'; # AUTHORITY
5  
6 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 17 ▶use Math::Random::Secure;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 0 ▶sub uuid {
Subroutine uuid: not called CC=1 SCAR=6.9
Pod undocumented
12 # UUIDv4 (random)
13 0 my @rand = map Math::Random::Secure::irand(2**32), 1..4;
14 0 return sprintf '%08x-%04x-%04x-%04x-%04x%08x',
15 $rand[0],
16 $rand[1] & 0xFFFF,
17 (($rand[1] & 0x0FFF0000) >> 16) | 0x4000,
18 $rand[2] & 0xBFFF,
19 ($rand[2] & 0xFFFF0000) >> 16,
20 $rand[3];
21 }
22  
23 17 1;
24  
25 =head1 AUTHOR
26  
27 Deriv Group Services Ltd. C<< DERIV@cpan.org >>.
28  
29 See L<Myriad/CONTRIBUTORS> for full details.
30  
31 =head1 LICENSE
32  
33 Copyright Deriv Group Services Ltd 2020-2022. Licensed under the same terms as Perl itself.
34  
« lib/Myriad/Example/Startup.pm ↑ Summary lib/Myriad/API.pm »