Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
irma2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
irma2
Commits
f08870cc
Commit
f08870cc
authored
Aug 1, 2017
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
streamlining for DataCite DOI minting and registration
parent
f1ec9ee5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
dcd.pl
+10
-0
10 additions, 0 deletions
dcd.pl
lib/DataCite/API.pm
+14
-8
14 additions, 8 deletions
lib/DataCite/API.pm
with
24 additions
and
8 deletions
dcd.pl
+
10
−
0
View file @
f08870cc
...
...
@@ -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",
This diff is collapsed.
Click to expand it.
lib/DataCite/API.pm
+
14
−
8
View file @
f08870cc
...
...
@@ -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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment