blob: 36f295d25b2020e7caf0fb3a5b42feb4915cb699 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package Travel::Status::DE::DBWagenreihung::Section;
use strict;
use warnings;
use 5.020;
use utf8;
use parent 'Class::Accessor';
our $VERSION = '0.03';
Travel::Status::DE::DBWagenreihung::Section->mk_ro_accessors(
qw(name start_percent end_percent length_percent start_meters end_meters length_meters)
);
sub new {
my ( $obj, %opt ) = @_;
my $ref = \%opt;
$ref->{length_meters} = $ref->{end_meters} - $ref->{start_meters};
$ref->{length_percent} = $ref->{end_percent} - $ref->{start_percent};
return bless( $ref, $obj );
}
sub TO_JSON {
my ($self) = @_;
my %copy = %{$self};
return {%copy};
}
1;
|