NAME
Wikibase::Datatype::Print::Value::Time - Wikibase time value pretty print helpers.
SYNOPSIS
use Wikibase::Datatype::Print::Value::Time qw(print);
my $pretty_print_string = print($obj, $opts_hr);
my @pretty_print_lines = print($obj, $opts_hr);
SUBROUTINES
print
my $pretty_print_string = print($obj, $opts_hr);
my @pretty_print_lines = print($obj, $opts_hr);
Construct pretty print output for Wikibase::Datatype::Value::Time object.
Returns string in scalar context. Returns list of lines in array context.
ERRORS
print():
Cannot parse datetime value.
Input string: %s
Object isn't 'Wikibase::Datatype::Value::Time'.
Option 'cb' must be a instance of Wikibase::Cache.
Unsupported precision '%s'.
EXAMPLE1
use strict;
use warnings;
use Wikibase::Datatype::Print::Value::Time;
use Wikibase::Datatype::Value::Time;
# Object.
my $obj = Wikibase::Datatype::Value::Time->new(
'precision' => 11,
'value' => '+2020-09-01T00:00:00Z',
);
# Print.
print Wikibase::Datatype::Print::Value::Time::print($obj)."\n";
# Output:
# 1 September 2020 (Q1985727)
EXAMPLE2
use strict;
use warnings;
use Wikibase::Cache;
use Wikibase::Cache::Backend::Basic;
use Wikibase::Datatype::Print::Value::Time;
use Wikibase::Datatype::Value::Time;
# Object.
my $obj = Wikibase::Datatype::Value::Time->new(
'precision' => 11,
'value' => '+2020-09-01T00:00:00Z',
);
# Cache object.
my $cache = Wikibase::Cache->new(
'backend' => 'Basic',
);
# Print.
print Wikibase::Datatype::Print::Value::Time::print($obj, {
'cb' => $cache,
})."\n";
# Output:
# 1 September 2020 (proleptic Gregorian calendar)
DEPENDENCIES
DateTime, English, Error::Pure, Exporter, Readonly.
SEE ALSO
- Wikibase::Datatype::Value::Time
-
Wikibase time value datatype.
REPOSITORY
https://github.com/michal-josef-spacek/Wikibase-Datatype-Print
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2020-2023 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.16