Commit b33ab39a authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add NewUUID() routine, which executes the uuidgen function and returns

the result (chomped and taint checked).
parent 428f735a
......@@ -18,7 +18,7 @@ use Exporter;
TBSCRIPTLOCK_OKAY TBSCRIPTLOCK_TIMEDOUT
TBSCRIPTLOCK_IGNORE TBSCRIPTLOCK_FAILED
PROJROOT GROUPROOT USERROOT SCRATCHROOT SHAREROOT
TBValidUserDir TBValidUserDirList TBMakeTempFile);
TBValidUserDir TBValidUserDirList TBMakeTempFile NewUUID);
# After package decl.
use English;
......@@ -668,4 +668,20 @@ sub TBScriptUnlock()
if defined($lockhandle);
}
#
# Get me a UUID (universally unique identifier). Its really nice that there
# is a program that does this! They look like this:
#
# 047edb7b-d346-11db-96cb-001143e453fe
#
sub NewUUID()
{
my $uuid = `/usr/bin/uuidgen`;
if ($uuid =~ /^(\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w{12})$/) {
return $1;
}
return undef;
}
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment