NAME
WebService::OCTranspo - Access schedule information from www.octranspo.com
SYNOPSIS
use WebService::OCTranspo;
# Brief but working code example(s) here showing the most common usage(s)
# This section will be as far as many users bother reading
# so make it as educational and exemplary as possible.
DESCRIPTION
This module provides access to some of the bus schedule information available from OCTranspo -- the public transit service in Ottawa, Ontario, Canada.
METHODS
new ( )
Creates a new WebService::OCTranspo object
schedule_for_stop ( $args )
Fetch schedule for a single route at a single stop. Returns reference to hash containing schedule info for that route at that stop.
TODO: schedule_for_stop should return an object, not a hashref.
$args must be a hash reference containing all of:
- stop_id
-
The numeric ID of the bus stop. This should be the "560 Code" displayed at each stop, usually used for retrieving the bus stop information by phone.
- route_id
-
The bus route number. Use integers only -- 'X' routes should omit the X suffix.
- date
-
A DateTime object
Return hashref contains:
- stop_number
-
4-digit OC Transpo stop number
- stop_name
-
Name of stop, or 'unknown' if not found
- route_number
-
1 to 3 digit OC Transpo route number
- route_name
-
Name of route, or 'unknown' if not found
- times
-
Reference to array of scalars representing stop times in local Ottawa time. Time values will be in one of two formats:
HH:MM
for plain times with no modifier, andHH:MM (X)
where X is the identifier of a route note mentioned in the notes section of the returned data. - notes
-
Reference to array of scalars representing route notes.
TODO: this should be a hashref
DIAGNOSTICS
schedule_for_stop()
will die() if the stop is not found, the route is not found, as well as on any WWW::Mechanize or HTML::Form errors that might be thrown.
DEPENDENCIES
WWW::Mechanize, HTML::Form::ForceValue, HTML::TableExtract, HTTP::Status
INCOMPATIBILITIES
There are no known incompatibilities with this module, but they probably do exist.
BUGS AND LIMITATIONS
Current known issues:
If the desired route leaves a stop in more than one direction (ie: Transitway stations) this module will only show the first one found on the page. Some way of specifying direction is needed.
Please report any new problems to the author. Patches are welcome.
AUTHOR
Dave O'Neill (dmo@dmo.ca)
LICENCE AND COPYRIGHT
Copyright (C) 2007 Dave O'Neill
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.