The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Wikibase::Datatype::Print::Form - Wikibase form pretty print helpers.

SYNOPSIS

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::Form object.

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

ERRORS

print():
From Wikibase::Datatype::Print::Utils::defaults():
Defined text keys are bad.
Object isn't 'Wikibase::Datatype::Form'.

EXAMPLE

use strict;
use Unicode::UTF8 qw(decode_utf8 encode_utf8);
# Object.
my $obj = Wikibase::Datatype::Form->new(
'grammatical_features' => [
# singular
Wikibase::Datatype::Value::Item->new(
'value' => 'Q110786',
),
# nominative case
Wikibase::Datatype::Value::Item->new(
'value' => 'Q131105',
),
],
'id' => 'L469-F1',
'representations' => [
Wikibase::Datatype::Value::Monolingual->new(
'language' => 'cs',
'value' => 'pes',
),
],
'statements' => [
Wikibase::Datatype::Statement->new(
'snak' => Wikibase::Datatype::Snak->new(
'datatype' => 'string',
'datavalue' => Wikibase::Datatype::Value::String->new(
'value' => decode_utf8('pɛs'),
),
'property' => 'P898',
),
),
],
);
# Print.
print encode_utf8(scalar Wikibase::Datatype::Print::Form::print($obj))."\n";
# Output:
# Id: L469-F1
# Representation: pes (cs)
# Grammatical features: Q110786, Q131105
# Statements:
# P898: pɛs (normal)

DEPENDENCIES

Error::Pure, Exporter, Readonly, Wikibase::Datatype::Print::Statement, Wikibase::Datatype::Print::Utils, Wikibase::Datatype::Print::Value::Item, Wikibase::Datatype::Print::Value::Monolingual.

SEE ALSO

Wikibase::Datatype::Form

Wikibase form 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-2025 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.18