NAME

Wikibase::Datatype::Value::Item - Wikibase item value datatype.

SYNOPSIS

 use Wikibase::Datatype::Value::Item;

 my $obj = Wikibase::Datatype::Value::Item->new(%params);
 my $type = $obj->type;
 my $value = $obj->value;

DESCRIPTION

This datatype is item class for representation of wikibase item (e.g. Q123).

METHODS

new

 my $obj = Wikibase::Datatype::Value::Item->new(%params);

Constructor.

Returns instance of object.

  • value

    Value of instance. Parameter must be in form /^Q\d+$/ (regexp). Parameter is required.

type

 my $type = $obj->type;

Get type. This is constant 'item'.

Returns string.

value

 my $value = $obj->value;

Get value.

Returns string.

ERRORS

 new():
         From Wikibase::Datatype::Utils::check_entity():
                 Parameter 'value' must begin with 'Q' and number after it.
         From Wikibase::Datatype::Value::new():
                 Parameter 'value' is required.

EXAMPLE

 use strict;
 use warnings;

 use Wikibase::Datatype::Value::Item;

 # Object.
 my $obj = Wikibase::Datatype::Value::Item->new(
         'value' => 'Q123',
 );

 # Get value.
 my $value = $obj->value;

 # Get type.
 my $type = $obj->type;

 # Print out.
 print "Type: $type\n";
 print "Value: $value\n";

 # Output:
 # Type: item
 # Value: Q123

DEPENDENCIES

Error::Pure, Mo, Wikibase::Datatype::Utils, Wikibase::Datatype::Value.

SEE ALSO

Wikibase::Datatype::Value

Wikibase datatypes.

REPOSITORY

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

AUTHOR

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

http://skim.cz

LICENSE AND COPYRIGHT

© 2020-2023 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.24