NAME
MARC::Convert::Wikidata::Utils - Utilities for MARC::Convert::Wikidata.
SYNOPSIS
use MARC::Convert::Wikidata::Utils qw(clean_cover clean_date clean_edition_number clean_number_of_pages clean_oclc clean_publication_date clean_publisher_name clean_publisher_place clean_series_name clean_series_ordinal clean_subtitle clean_title look_for_external_id);
my $cleaned_cover = clean_cover($cover);
my $cleaned_date = clean_date($date);
my ($cleaned_date, $options_hr) = clean_date($date);
my $cleaned_edition_number = clean_edition_number($edition_number);
my $cleaned_number_of_pages = clean_number_of_pages($number_of_pages);
my $cleaned_oclc = clean_oclc($oclc);
my ($cleaned_publication_date, $option) = clean_publication_date($publication_date);
my $cleaned_publisher_name = clean_publisher_name($publisher);
my $cleaned_publisher_place = clean_publisher_place($publisher_place);
my $cleaned_series_name = clean_series_name($series_name);
my $cleaned_series_ordinal = clean_series_ordinal($series_ordinal);
my $cleaned_subtitle = clean_subitle($subtitle);
my $cleaned_title = clean_title($title);
my $value = look_for_external_id($object, $external_id_name, $deprecation_flag);
my @values = look_for_external_id($object, $external_id_name, $deprecation_flag);
SUBROUTINES
clean_cover
my $cleaned_cover = clean_cover($cover);
Clean book cover in Czech language.
Returns string or undef.
clean_date
my $cleaned_date = clean_date($date);
my ($cleaned_date, $options_hr) = clean_date($date);
Clean date in Czech language.
Returns string or undef in scalar context. Returns string or undef of date and hash reference with options in array context.
clean_edition_number
my $cleaned_edition_number = clean_edition_number($edition_number);
Clean edition number in Czech language.
Returns string or undef.
clean_number_of_pages
my $cleaned_number_of_pages = clean_number_of_pages($number_of_pages);
Clean number of pages in Czech language.
Returns string or undef.
clean_oclc
my $cleaned_oclc = clean_oclc($oclc);
Clean OCLC number.
Returns string or undef.
clean_publication_date
my ($cleaned_publication_date, $option) = clean_publication_date($publication_date);
Clean publication date. Returned options could be 'circa' string in case that publication date is not precise.
Returns array with string or undef and string.
clean_publisher_name
my $cleaned_publisher_name = clean_publisher_name($publisher);
Clean publishing house.
Returns string or undef.
clean_publisher_place
my $cleaned_publisher_place = clean_publisher_place($publisher_place);
Clean place of publication in Czech language.
Returns string or undef.
clean_series_name
my $cleaned_series_name = clean_series_name($series_name);
Clean series name.
Returns string or undef.
clean_series_ordinal
my $cleaned_series_ordinal = clean_series_ordinal($series_ordinal);
Clean series ordinal in Czech language.
Returns string or undef.
clean_subtitle
my $cleaned_subtitle = clean_subtitle($subtitle);
Clean subtitle.
Returns string or undef.
clean_title
my $cleaned_title = clean_title($title);
Clean title.
Returns string or undef.
look_for_external_id
my $value = look_for_external_id($object, $external_id_name, $deprecation_flag);
my @values = look_for_external_id($object, $external_id_name, $deprecation_flag);
Look for external id values defined by name and deprecation flag.
Returns strings.
EXAMPLE1
use strict;
use warnings;
use MARC::Convert::Wikidata::Utils qw(clean_cover);
use Unicode::UTF8 qw(decode_utf8 encode_utf8);
my $cover = decode_utf8('(Vázáno) :');;
my $cleaned_cover = clean_cover($cover);
# Print out.
print encode_utf8("Cover: $cover\n");
print "Cleaned cover: $cleaned_cover\n";
# Output:
# Cover: (Vázáno) :
# Cleaned cover: hardback
EXAMPLE2
use strict;
use warnings;
use MARC::Convert::Wikidata::Utils qw(clean_date);
use Unicode::UTF8 qw(decode_utf8 encode_utf8);
my $date = decode_utf8('2020 březen 03.');
my $cleaned_date = clean_date($date);
# Print out.
print encode_utf8("Date: $date\n");
print "Cleaned date: $cleaned_date\n";
# Output:
# Date: 2020 březen 03.
# Cleaned date: 2020-03-03
EXAMPLE3
use strict;
use warnings;
use MARC::Convert::Wikidata::Utils qw(clean_edition_number);
use Unicode::UTF8 qw(decode_utf8 encode_utf8);
my $edition_number = decode_utf8('Druhé vydání');
my $cleaned_edition_number = clean_edition_number($edition_number);
# Print out.
print encode_utf8("Edition number: $edition_number\n");
print "Cleaned edition number: $cleaned_edition_number\n";
# Output:
# Edition number: Druhé vydání
# Cleaned edition number: 2
EXAMPLE4
use strict;
use warnings;
use MARC::Convert::Wikidata::Utils qw(clean_number_of_pages);
my $number_of_pages = '575 s. ;';
my $cleaned_number_of_pages = clean_number_of_pages($number_of_pages);
# Print out.
print "Number of pages: $number_of_pages\n";
print "Cleaned number of pages: $cleaned_number_of_pages\n";
# Output:
# Number of pages: 575 s. ;
# Cleaned number of pages: 575
DEPENDENCIES
Exporter, List::Util, Readonly, Roman, Unicode::UTF8.
REPOSITORY
https://github.com/michal-josef-spacek/MARC-Convert-Wikidata
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2021-2024 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.15