blib/lib/Catmandu/IdGenerator.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 15 / 15 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Catmandu/Fixable.pm ↑ Summary blib/lib/Catmandu/Logger.pm »
1 package Catmandu::IdGenerator;
2  
3 16 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 16 our $VERSION = '1.0201_02';
6  
7 16 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 16 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 16 requires 'generate';
11  
12 16 1;
13  
14 __END__
15  
16 =pod
17  
18 =head1 NAME
19  
20 Catmandu::IdGenerator - A base class for modules that needs to generate identifiers
21  
22 =head1 SYNOPSIS
23  
24 package MyPackage;
25  
26 use Moo;
27  
28 with 'Catmandu::IdGenerator';
29  
30 sub generate {
31 return int(rand(999999)) . "-" . time;
32 }
33  
34 package main;
35  
36 my $x = MyPackage->new;
37  
38 for (1..100) {
39 printf "id: %s\n" m $x->generate;
40 }
41  
42 =head1 SEE ALSO
43  
44 L<Catmandu::IdGenerator::Mock> ,
45 L<Catmandu::IdGenerator::UUID>
46  
47 =cut
« blib/lib/Catmandu/Fixable.pm ↑ Summary blib/lib/Catmandu/Logger.pm »