diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-05-23 11:14:22 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-05-23 11:14:22 +0200 |
commit | 4da3a72be49f769c307381d92320bc7baefe2a01 (patch) | |
tree | e3f0502f3298c14eb04891e1db4a0ea84abb9c82 /lib/Net/Travel/DE/VRR | |
parent | 194c4ee9eb2eb8eb45af78b8feed39ef53615e1b (diff) |
Introducing ::Route and ::Route::Part
Diffstat (limited to 'lib/Net/Travel/DE/VRR')
-rw-r--r-- | lib/Net/Travel/DE/VRR/Route.pm | 72 | ||||
-rw-r--r-- | lib/Net/Travel/DE/VRR/Route/Part.pm | 69 |
2 files changed, 141 insertions, 0 deletions
diff --git a/lib/Net/Travel/DE/VRR/Route.pm b/lib/Net/Travel/DE/VRR/Route.pm new file mode 100644 index 0000000..1b71097 --- /dev/null +++ b/lib/Net/Travel/DE/VRR/Route.pm @@ -0,0 +1,72 @@ +package Net::Travel::DE::VRR::Route; + +use strict; +use warnings; +use 5.010; + +use Net::Travel::DE::VRR::Route::Part; + +our $VERSION = '1.3'; + +sub new { + my ( $obj, @parts ) = @_; + + my $ref = {}; + + for my $part (@parts) { + push( + @{ $ref->{parts} }, + Net::Travel::DE::VRR::Route::Part->new( %{$part} ) + ); + } + + return bless( $ref, $obj ); +} + +sub parts { + my ($self) = @_; + + return @{ $self->{parts} }; +} + +1; + +__END__ + +=head1 NAME + +Net::Travel::DE::VRR::Route - Single route (connection) between two points + +=head1 SYNOPSIS + +=head1 VERSION + +version 1.3 + +=head1 DESCRIPTION + +=head1 METHODS + +=over + +=back + +=head1 DIAGNOSTICS + +=head1 DEPENDENCIES + +=over + +=back + +=head1 BUGS AND LIMITATIONS + +=head1 SEE ALSO + +=head1 AUTHOR + +Copyright (C) 2011 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt> + +=head1 LICENSE + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/lib/Net/Travel/DE/VRR/Route/Part.pm b/lib/Net/Travel/DE/VRR/Route/Part.pm new file mode 100644 index 0000000..d512fbb --- /dev/null +++ b/lib/Net/Travel/DE/VRR/Route/Part.pm @@ -0,0 +1,69 @@ +package Net::Travel::DE::VRR::Route::Part; + +use strict; +use warnings; +use 5.010; + +use parent 'Class::Accessor'; + +our $VERSION = '1.3'; + +Net::Travel::DE::VRR::Route::Part->mk_ro_accessors( + qw(arr_stop arr_time dep_stop dep_time train_line train_dest)); + +sub new { + my ( $obj, %conf ) = @_; + + my $ref = \%conf; + + return bless( $ref, $obj ); +} + +sub extra { + my ($self) = @_; + + return @{ $self->{extra} // [] }; +} + +1; + +__END__ + +=head1 NAME + +Net::Travel::DE::VRR::Route::Part - Describes one connection between two +points, without interchanges + +=head1 SYNOPSIS + +=head1 VERSION + +version 0.3 + +=head1 DESCRIPTION + +=head1 METHODS + +=over + +=back + +=head1 DIAGNOSTICS + +=head1 DEPENDENCIES + +=over + +=back + +=head1 BUGS AND LIMITATIONS + +=head1 SEE ALSO + +=head1 AUTHOR + +Copyright (C) 2011 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt> + +=head1 LICENSE + + 0. You just DO WHAT THE FUCK YOU WANT TO. |