The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Wikibase::Datatype::Value::Property - Wikibase property value datatype.

SYNOPSIS

 use Wikibase::Datatype::Value::Property;

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

DESCRIPTION

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

METHODS

new

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

Constructor.

Returns instance of object.

  • value

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

type

 my $type = $obj->type;

Get type. This is constant 'property'.

Returns string.

value

 my $value = $obj->value;

Get value.

Returns string.

ERRORS

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

EXAMPLE

 use strict;
 use warnings;

 use Wikibase::Datatype::Value::Property;

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

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

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

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

 # Output:
 # Type: property
 # Value: P123

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.33