File Coverage

blib/lib/Net/DAV/UUID.pm
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 10 11 90.9


line stmt bran cond sub pod time code
1             package Net::DAV::UUID;
2              
3 18     18   23997 use strict;
  18         34  
  18         1226  
4              
5             our $VERSION = '1.305';
6             $VERSION = eval $VERSION; # convert development version into a simpler version number.
7              
8 18     18   18202 use Digest::SHA1 qw(sha1);
  18         146881  
  18         3279  
9              
10             my $counter = 0;
11              
12             #
13             # Given a WebDAV resource path and lock requestor/owner, generate
14             # a UUID mostly compliant with RFC 4918 section 20.7. Despite the
15             # lack of EUI64 identifier in the host portion of the UUID, the
16             # value generated is likely not cryptographically sound and should
17             # not be used in production code outside of the limited realm of a
18             # WebDAV server implementation.
19             #
20             # Note that due to the nature of the underlying libc function rand(),
21             # it would be best that any concurrent WebDAV services built upon
22             # this package synchronize upon usages of this method.
23             #
24             sub generate {
25 10075     10075 0 133302 return join '-', unpack('H8 H4 H4 H4 H12', sha1( join( ':', @_[0,1], time, rand, $<, $$, ++$counter ) ));
26             }
27              
28             1;
29              
30             __END__