Wikibase::Datatype::Reference - Wikibase reference datatype.
use Wikibase::Datatype::Reference; my $obj = Wikibase::Datatype::Reference->new(%params); my $snaks_ar = $obj->snaks;
This datatype is reference class for all references in claim.
new
my $obj = Wikibase::Datatype::Reference->new(%params);
Constructor.
Returns instance of object.
snaks
Reference to array with Wikibase::Datatype::Snak instances. Parameter is required.
my $snaks_ar = $obj->snaks;
Get snaks.
Returns reference to array of Wikibase::Datatype::Snak instances.
new(): From Mo::utils::check_array_object(): Parameter 'snaks' must be a array. Snak isn't 'Wikibase::Datatype::Snak' object. From Mo::utils::check_required(): Parameter 'snaks' is required.
use strict; use warnings; use Wikibase::Datatype::Reference; use Wikibase::Datatype::Snak; use Wikibase::Datatype::Value::String; use Wikibase::Datatype::Value::Time; # Object. my $obj = Wikibase::Datatype::Reference->new( 'snaks' => [ Wikibase::Datatype::Snak->new( 'datatype' => 'url', 'datavalue' => Wikibase::Datatype::Value::String->new( 'value' => 'https://skim.cz', ), 'property' => 'P854', ), Wikibase::Datatype::Snak->new( 'datatype' => 'time', 'datavalue' => Wikibase::Datatype::Value::Time->new( 'value' => '+2013-12-07T00:00:00Z', ), 'property' => 'P813', ), ], ); # Get value. my $snaks_ar = $obj->snaks; # Print out number of snaks. print "Number of snaks: ".@{$snaks_ar}."\n"; # Output: # Number of snaks: 2
Error::Pure, Mo, Mo::utils.
Wikibase datatypes.
Wikibase snak datatype.
https://github.com/michal-josef-spacek/Wikibase-Datatype
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2020-2023 Michal Josef Špaček
BSD 2-Clause License
0.31
To install Wikibase::Datatype, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Wikibase::Datatype
CPAN shell
perl -MCPAN -e shell install Wikibase::Datatype
For more information on module installation, please visit the detailed CPAN module installation guide.