The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Wikibase::Datatype::Value::Sense - Wikibase sense value datatype.

SYNOPSIS

 use Wikibase::Datatype::Value::Sense;

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

DESCRIPTION

This datatype is sense class for representation of wikibase item (e.g. L34727-S1).

METHODS

new

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

Constructor.

Returns instance of object.

  • value

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

type

 my $type = $obj->type;

Get type. This is constant 'sense'.

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_sense():
                 Parameter 'value' must begin with 'L' and number, dash, S and number after it.

EXAMPLE

 use strict;
 use warnings;

 use Wikibase::Datatype::Value::Sense;

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

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

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

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

 # Output:
 # Type: sense
 # Value: L34727-S1

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