NAME

Wikibase::Datatype::Print::Value::Quantity - Wikibase quantity value pretty print helpers.

SYNOPSIS

use Wikibase::Datatype::Print::Value::Quantity 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::Quantity object.

Returns string in scalar context. Returns list of lines in array context.

ERRORS

print():
        Object isn't 'Wikibase::Datatype::Value::Quantity'.
        Option 'cb' must be a instance of Wikibase::Cache.

EXAMPLE1

use strict;
use warnings;

use Wikibase::Datatype::Print::Value::Quantity;
use Wikibase::Datatype::Value::Quantity;

# Object.
my $obj = Wikibase::Datatype::Value::Quantity->new(
        'unit' => 'Q190900',
        'value' => 10,
);

# Print.
print Wikibase::Datatype::Print::Value::Quantity::print($obj)."\n";

# Output:
# 10 (Q190900)

EXAMPLE2

use strict;
use warnings;

use Wikibase::Cache;
use Wikibase::Cache::Backend::Basic;
use Wikibase::Datatype::Print::Value::Quantity;
use Wikibase::Datatype::Value::Quantity;

# Object.
my $obj = Wikibase::Datatype::Value::Quantity->new(
        'unit' => 'Q11573',
        'value' => 10,
);

# Cache object.
my $cache = Wikibase::Cache->new(
        'backend' => 'Basic',
);

# Print.
print Wikibase::Datatype::Print::Value::Quantity::print($obj, {
        'cb' => $cache,
})."\n";

# Output:
# 10 (metre)

DEPENDENCIES

Error::Pure, Exporter, Readonly.

SEE ALSO

Wikibase::Datatype::Value::Quantity

Wikibase quantity value datatype.

REPOSITORY

https://github.com/michal-josef-spacek/Wikibase-Datatype-Print

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2020-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.17