NAME
Wikibase::Datatype::Value::Globecoordinate - Wikibase globe coordinate value datatype.
SYNOPSIS
use Wikibase::Datatype::Value::Globecoordinate;
my $obj = Wikibase::Datatype::Value::Globecoordinate->new(%params);
my $altitude = $obj->altitude;
my $globe = $obj->globe;
my $latitude = $obj->latitude;
my $longitude = $obj->longitude;
my $precision = $obj->precision;
my $type = $obj->type;
my $value = $obj->value;
DESCRIPTION
This datatype is globecoordinate class for representation of coordinate.
METHODS
new
my $obj = Wikibase::Datatype::Value::Globecoordinate->new(%params);
Constructor.
Returns instance of object.
altitude
Altitude. Parameter is optional. Default value is undef.
globe
Globe entity. Parameter is optional. Default value is 'Q2'.
precision
Coordinate precision. Parameter is optional. Default value is '1e-07'.
value
Value of instance. Parameter is required.
altitude
my $altitude = $obj->altitude;
Get altitude.
Returns TODO
globe
my $globe = $obj->globe;
Get globe. Unit is entity (e.g. /^Q\d+$/).
Returns string.
latitude
my $latitude = $obj->latitude;
Get latitude.
Returns number.
longitude
my $longitude = $obj->longitude;
Get longitude.
Returns number.
precision
my $precision = $obj->precision;
Get precision.
Returns number.
type
my $type = $obj->type;
Get type. This is constant 'string'.
Returns string.
value
my $value = $obj->value;
Get value.
Returns string.
ERRORS
new():
From Wikibase::Datatype::Utils::check_entity():
Parameter 'globe' must begin with 'Q' and number after it.
From Wikibase::Datatype::Value::new():
Parameter 'value' is required.
Parameter 'value' array must have two fields (latitude and longitude).
Parameter 'value' has bad first parameter (latitude).
Parameter 'value' has bad first parameter (longitude).
Parameter 'value' must be a array.
EXAMPLE
use strict;
use warnings;
use Wikibase::Datatype::Value::Globecoordinate;
# Object.
my $obj = Wikibase::Datatype::Value::Globecoordinate->new(
'value' => [49.6398383, 18.1484031],
);
# Get globe.
my $globe = $obj->globe;
# Get longitude.
my $longitude = $obj->longitude;
# Get latitude.
my $latitude = $obj->latitude;
# Get precision.
my $precision = $obj->precision;
# Get type.
my $type = $obj->type;
# Get value.
my $value_ar = $obj->value;
# Print out.
print "Globe: $globe\n";
print "Latitude: $latitude\n";
print "Longitude: $longitude\n";
print "Precision: $precision\n";
print "Type: $type\n";
print 'Value: '.(join ', ', @{$value_ar})."\n";
# Output:
# Globe: Q2
# Latitude: 49.6398383
# Longitude: 18.1484031
# Precision: 1e-07
# Type: globecoordinate
# Value: 49.6398383, 18.1484031
DEPENDENCIES
Error::Pure, Mo, Wikibase::Datatype::Utils, Wikibase::Datatype::Value.
SEE ALSO
- Wikibase::Datatype::Value
-
Wikibase datatypes.
- Wikibase::Datatype::Print::Value::Globecoordinate
-
Wikibase globe coordinate value pretty print helpers.
REPOSITORY
https://github.com/michal-josef-spacek/Wikibase-Datatype
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2020-2023 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.33