Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SLUB_SIP_Builder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
SLUB_SIP_Builder
Commits
40186ccf
Commit
40186ccf
authored
4 years ago
by
Jens Steidl
Browse files
Options
Downloads
Patches
Plain Diff
- refactor: encapsulated title check
parent
cddd4282
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/slubsipbuilderbagit.pl
+14
-7
14 additions, 7 deletions
bin/slubsipbuilderbagit.pl
with
14 additions
and
7 deletions
bin/slubsipbuilderbagit.pl
+
14
−
7
View file @
40186ccf
...
...
@@ -47,6 +47,7 @@ package SLUB::LZA::SIPBuilderBagIt;
use
File::Copy::
Recursive
qw(dircopy dirmove)
;
use
File::
Basename
;
use
File::
Find
;
use
List::
Util
qw(none)
;
use
LWP::
UserAgent
;
# to get MARC data
use
MARC::
Record
;
use
Path::
Tiny
;
...
...
@@ -568,6 +569,18 @@ PATCH
SLUB::LZA::SIPBuilderBagIt::
create_slub_bagit
(
$bagPath
,
\
@addBagInfo
);
}
sub
checkForTitle
($){
my
$key_hash_list_aref
=
shift
;
# collect all bag-info keys for easy check
my
@keys
;
for
my
$hash
(
@
{
$key_hash_list_aref
})
{
push
@keys
,
keys
%
{
$hash
};
}
# check for title
print_scalar_data
("",
"
WARNING: No Title given. Please consider adding a human-readable title with '--add_key_value=Title:YOUR-TITLE'
",
"",
"
yellow
")
if
none
{
$_
=~
m/^[Tt][Ii][Tt][Ll][Ee]/
}
@keys
;
}
# end package
package
main
;
...
...
@@ -587,7 +600,6 @@ use Getopt::Long;
use
Path::
Tiny
;
use
Carp
;
# confess()
use
Pod::
Usage
;
# pod2usage()
use
List::
Util
qw(none)
;
my
$save
;
my
$ieDirectory
;
...
...
@@ -768,12 +780,7 @@ sub main{
my
$bagNameDir
=
SLUB::LZA::SIPBuilderBagIt::
generateBagName
(
$exportToArchiveDate
,
$ppn
,
$noppn
);
# user hints
my
@keys
;
for
my
$hash
(
@addBagInfo
)
{
push
@keys
,
keys
%
{
$hash
};
}
SLUB::LZA::SIPBuilderBagIt::
print_scalar_data
("",
"
WARNING: No Title given. Please consider adding a human-readable title with '--add_key_value=Title:YOUR-TITLE'
",
"",
"
yellow
")
if
none
{
$_
=~
m/^[Tt][Ii][Tt][Ll][Ee]/
}
@keys
;
SLUB::LZA::SIPBuilderBagIt::
checkForTitle
(
\
@addBagInfo
);
# save options
if
(
$save
eq
"
copy
")
{
...
...
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