File Coverage

blib/lib/UUID.pm
Criterion Covered Total %
statement 41 42 97.6
branch 13 14 92.8
condition 15 18 83.3
subroutine 5 5 100.0
pod n/a
total 74 79 93.6


line stmt bran cond sub pod time code
1             package UUID;
2             require 5.005063;
3 215     215   26028364 use strict;
  215         453  
  215         8352  
4 215     215   1167 use warnings;
  215         402  
  215         12655  
5 215     215   1558 use Carp 'croak';
  215         401  
  215         17358  
6              
7             require Exporter;
8             require DynaLoader;
9              
10 215     215   1282 use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $VERSION);
  215         811  
  215         121066  
11             @ISA = qw(DynaLoader);
12              
13             $VERSION = '0.37_06';
14              
15             %EXPORT_TAGS = (
16             'all' => [qw(
17             &clear &compare © &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             @EXPORT_OK = @{$EXPORT_TAGS{'all'}};
26              
27             bootstrap UUID $VERSION;
28              
29             sub import {
30 184     184   2810601 for (my $i=scalar(@_)-1 ; $i>0 ; --$i) {
31 237         593 my $v = $_[$i];
32 237         607 chomp $v;
33             # :persist=FOO
34 237 100 100     989 if (length($v) > 8 and substr($v,0,8) eq ':persist') {
35 7         15 my $arg = substr $v, 8;
36 7 50 33     37 if (length($arg) < 2 or substr($arg, 0, 1) ne '=') {
37 0         0 croak "Usage: :persist=FILE";
38             }
39 7         13 my $file = substr $arg, 1;
40 7         46 _persist($file);
41 7         13 splice @_, $i, 1;
42 7         26 next;
43             }
44             # :mac=random
45 230 100 100     838 if (length($v) == 11 and $v eq ':mac=random') {
46 8         62 _hide_mac();
47 8         18 splice @_, $i, 1;
48 8         24 next;
49             }
50             # :mac=unique
51 222 100 100     844 if (length($v) == 11 and $v eq ':mac=unique') {
52 2         25 _hide_always();
53 2         5 splice @_, $i, 1;
54 2         6 next;
55             }
56             # :defer[=N]
57 220 100 100     1337 if (length($v) >= 6 and substr($v,0,6) eq ':defer') {
58 6         29 my $arg = substr $v, 6;
59 6         10 my $len = length $arg;
60 6 100 66     47 if ($len == 0) {
    100          
61 1         1 $arg = '=0.001';
62             }
63             elsif ($len == 1 or substr($arg, 0, 1) ne '=') {
64 1         245 croak "Usage: :defer[=N]";
65             }
66 5         9 my $val = substr $arg, 1;
67 5         72 _defer($val);
68 4         11 splice @_, $i, 1;
69 4         30 next;
70             }
71             }
72 182         7346306 goto &Exporter::import;
73             }
74              
75             # Preloaded methods go here.
76              
77             1;
78             __END__