-
Birte Kristina Friesel authoredBirte Kristina Friesel authored
Location.pm 2.03 KiB
package Travel::Status::DE::HAFAS::Location;
use strict;
use warnings;
use 5.014;
use parent 'Class::Accessor';
our $VERSION = '4.19';
Travel::Status::DE::HAFAS::Location->mk_ro_accessors(
qw(lid type name eva state lat lon distance_m weight));
sub new {
my ( $obj, %opt ) = @_;
my $loc = $opt{loc};
my $ref = {
lid => $loc->{lid},
type => $loc->{type},
name => $loc->{name},
eva => 0 + $loc->{extId},
state => $loc->{state},
lat => $loc->{crd}{y} * 1e-6,
lon => $loc->{crd}{x} * 1e-6,
# only for geosearch requests
weight => $loc->{wt},
distance_m => $loc->{dist},
};
bless( $ref, $obj );
return $ref;
}
sub TO_JSON {
my ($self) = @_;
my $ret = { %{$self} };
return $ret;
}
1;
__END__
=head1 NAME
Travel::Status::DE::HAFAS::Location - A single public transit location
=head1 SYNOPSIS
printf("Destination: %s (%8d)\n", $location->name, $location->eva);
=head1 VERSION
version 4.19
=head1 DESCRIPTION
Travel::Status::DE::HAFAS::Location describes a HAFAS location that belongs to
a stop (e.g. on a journey's route) or has been returned as part of a
locationSearch or geoSearch request.
=head1 METHODS
=head2 ACCESSORS