| 1 | package Net::DAV::UUID; | ||
| 2 | |||
| 3 | 32 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 32 | our $VERSION = '1.304'; | |
| 6 | 32 | $VERSION = eval $VERSION; # convert development version into a simpler version number. | |
| 7 | |||
| 8 | 32 | ▶ | use Digest::SHA1 qw(sha1); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 32 | 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 | 10103 | ▶ | return join '-', unpack('H8 H4 H4 H4 H12', sha1( join( ':', @_[0,1], time, rand, $<, $$, ++$counter ) )); |
|
Subroutine
generate: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 26 | } | ||
| 27 | |||
| 28 | 32 | 1; | |
| 29 | |||
| 30 | __END__ | ||