Skip to content
Snippets Groups Projects
Commit ecf119f2 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

experiments with DataCite DOI

parent 2f02ab45
No related branches found
No related tags found
No related merge requests found
...@@ -100,9 +100,9 @@ sub register_url ...@@ -100,9 +100,9 @@ sub register_url
my $repo_url= shift; my $repo_url= shift;
print __LINE__, " repo_url=[$repo_url]\n"; print __LINE__, " repo_url=[$repo_url]\n";
if ($repo_url =~ m#^https://(phaidra(-(sandbox|temp))?\.univie\.ac\.at)/(o:\d+)$#) if ($repo_url =~ m#^https?://(phaidra(-(sandbox|temp))?\.univie\.ac\.at)/(detail_object/)?(o:\d+)$#)
{ {
my ($repo, $s1, $s2, $pid)= ($1, $2, $3, $4); my ($repo, $s1, $s2, $s3, $pid)= ($1, $2, $3, $4, $5);
usage ("unknown repo=[$repo]") unless (exists ($cnf->{repositories}->{$repo})); usage ("unknown repo=[$repo]") unless (exists ($cnf->{repositories}->{$repo}));
print __LINE__, " repo=[$repo]\n"; print __LINE__, " repo=[$repo]\n";
......
...@@ -9,20 +9,23 @@ use Encode::Base32::Crockford; ...@@ -9,20 +9,23 @@ use Encode::Base32::Crockford;
# check(); exit; # check(); exit;
my $prefix= '10.0174';
my $cnt= 10_000_000; my $cnt= 10_000_000;
while ($cnt-- > 0) while ($cnt-- > 0)
{ {
my $str= mk_doi(); my $str= mk_doi();
# next unless (defined ($str)); # next unless (defined ($str));
print $str, "\n"; # print $str, "\n";
print join ('/', $prefix, $str), "\n";
} }
exit(0); exit(0);
sub mk_doi sub mk_doi
{ {
my $tries= 1; my $tries= 5;
my $str; my $str;
do do
...@@ -32,10 +35,11 @@ sub mk_doi ...@@ -32,10 +35,11 @@ sub mk_doi
$str= Encode::Base32::Crockford::base32_encode_with_checksum($num); $str= Encode::Base32::Crockford::base32_encode_with_checksum($num);
# printf ("%12d %s\n", $num, $str); # printf ("%12d %s\n", $num, $str);
return join ('-', $tries, $1, $2) if ($str =~ m#^([A-Z0-9]{4})([A-Z0-9]{4})$#); # return join ('-', $tries, $1, $2) if ($str =~ m#^([A-Z0-9]{4})([A-Z0-9]{4})$#);
} while ($tries-- > 0); } while ($tries-- > 0);
return join ('-', $tries, $1, $2) if ($str =~ m#^(.{4})(.{4})$#); return join ('-', $1, $2) if ($str =~ m#^([A-Z0-9]{4})([A-Z0-9]{4})$#);
# return join ('-', $tries, $1, $2) if ($str =~ m#^(.{4})(.{4})$#);
return ($str); return ($str);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment