NAME
WWW::PTV::TimeTable - Class for operations with PTV timetables.
SYNOPSIS
use WWW::PTV;
my $ptv = WWW::PTV->new;
# Get the next outbound departure time for route 1 from stop ID 19849
my $next = $ptv->get_route_by_id(1)
->get_outbound_tt;
print "The next service is scheduled at @$next\n";
# Get the next five services for route 1 from the same stop.
my $next = $ptv->get_route_by_id(1)
->get_outbound_tt
->get_schedule_by_stop_id(19849)
->next_five;
DESCRIPTION
This module implements a utility class providing operations for PTV timetables.
Please note the terminology used for the naming of this module should not imply relationships between routes, timetables, schedules and other objects. In brief, the relationships between objects defined in the WWW::PTV namespace are:
1 *
route --- has ---> timetables
1 *
timetable --- has ---> schedules
1 *
schedule --- has ---> stops (service times)
That is to say; a route may have one or more timetables (inbound, outbound, weekend, public holiday, etc.), each of which is composed of one or more schedules where a schedules is defined as the list of service times for a particular stop on that route.
METHODS
stop_ids ()
my @stop_ids = $timetable->stop_ids;
print "Stops on this route: " . join ", ", @stop_ids . "\n";
Returns a list of in order stop IDs for this route in the selected direction.
stop_names ()
Returns a list of in order stop IDs for this route in the selected direction.
print "This service will be stopping at : "
. join ", ", $timetable->stop_names . "\n";
stop_names_and_ids ()
Returns a list of lists with each sublist containing the stop ID as the first element, and the station name as the second providing an in-order mapping of stop IDs and names.
get_schedule_by_stop_id ( $ID )
# Print a nicely formatted list of service times for
# the outbound direction of route 1 for stop ID 19849
$ptv->get_route_by_id( 1 )
->get_outbound_tt
->get_schedule_by_stop_id( 19849 )
->pretty_print;
get_schedule_by_stop_name ( $NAME )
# Get a list of service times for route 1 in the
# outbound direction for the first station having
# a name matching /wood/i (this will be stop ID
# 19849 - 'Burwood').
$ptv->get_route_by_id( 1 )
->get_outbound_tt
->get_schedule_by_stop_name( 'burwood' )
->as_list;
pretty_print ()
Prints a formatted version of the complete timetable. Note that for timetables with a large number of service times, this method will produce very wide output that may not be viewable even on large screens.
AUTHOR
Luke Poskitt, <ltp at cpan.org>
BUGS
Please report any bugs or feature requests to bug-www-ptv-timetable at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-PTV-TimeTable. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WWW::PTV::TimeTable
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
Copyright 2014 Luke Poskitt.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.