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

streamlining for DataCite DOI minting and registration

parent f1ec9ee5
No related branches found
No related tags found
No related merge requests found
......@@ -240,3 +240,13 @@ __END__
Firstname Lastname <address@example.org>
=head1 BUGS
wrong registry label is not dectected, e.g. when using
"registry" : "DataCite_Test_prod",
instead of
"registry" : "DataCite_Test_Prod",
......@@ -13,6 +13,7 @@ Interact with DataCitee API ([1], [2])
* [2] https://mds.test.datacite.org/static/apidoc
* [3] http://schema.test.datacite.org/
* [4] https://blog.datacite.org/cool-dois/
* [5] http://www.crockford.com/wrmg/base32.html
=cut
......@@ -36,7 +37,7 @@ sub mint_doi
# my $prefix= ($self->{mode} eq 'test') ? $cfg->{test_prefix} : $cfg->{prefix};
return join ('/', $self->{config}->{prefix}, mk_doi()),
return join ('/', $self->{config}->{prefix}, mk_suffix()),
}
sub register_doi
......@@ -103,15 +104,15 @@ sub datacite_request
=head1 INTERNAL FUNCTIONS
=head2 $doi= mk_doi()
=head2 $doi= mk_suffix()
actually mint a DOI according to [4]
=cut
sub mk_doi
sub mk_suffix
{
my $tries= 3;
my $tries= 10;
my $str;
do
......@@ -124,8 +125,13 @@ sub mk_doi
return join ('-', $1, $2) if ($str =~ m#^([A-Z0-9]{4})([A-Z0-9]{4})$#);
} while ($tries-- > 0);
# TODO: print some kind of warning?
# As a last resort, print the string which might
# contain *, =, ~, and $ .
# These strings are valid, but maybe less readable ...
return join ('-', $1, $2) if ($str =~ m#^(.{4})(.{4})$#);
# TODO: this should not happen, print some kind of warning?
return ($str);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment