version 0.003
WWW::IRail::API::Stations - HTTP::Request builder and HTTP::Response parser for the IRail API Station data
use WWW::IRail::API::Stations; use LWP::UserAgent(); my $ua = new LWP::UserAgent(); $ua->timeout(20); my $station_req = WWW::IRail::API::Stations::make_request(); my $http_resp = $ua->request($station_req); my $result = WWW::IRail::API::Stations::parse_response($http_resp,'perl');
This module builds a HTTP::Request and has a parser for the HTTP::Response. It's up to you to transmit it over the wire. If don't want to do that yourself, don't use this module directly and use WWW::IRail::API instead.
Has no arguments, requests the whole list of stations from the API
parses the HTTP::Response you got back from the server, which if all went well contains XML. That XML is then transformed into other data formats.
Note that the perl data format returns the data unnested for easier access.
xml
XML
YAML
JSON
perl (default)
<stations> <station>\'S GRAVENBRAKEL</station> <station>AALST</station> <station>AALST KERREBROEK</station> <!-- ... snip ... --> </stations>
<stations timestamp="1291047694" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="stations.xsd"> <station id="BE.NMBS.82" location="50.605075 4.137658" locationX="4.137658" locationY="50.605075">\'S GRAVENBRAKEL</station> <station id="BE.NMBS.1" location="50.943053 4.038586" locationX="4.038586" locationY="50.943053">AALST</station> <station id="BE.NMBS.2" location="50.948316 4.024773" locationX="4.024773" locationY="50.948316">AALST KERREBROEK</station> <!-- ... snip ... --> </stations>
{ "station" : [ "\'S GRAVENBRAKEL", "AALST", "AALST KERREBROEK", "AALTER", // ... ] }
station: - "\'S GRAVENBRAKEL" - AALST - AALST KERREBROEK - AALTER ...
$VAR1 = [ '\'S GRAVENBRAKEL', 'AALST', 'AALST KERREBROEK', 'AALTER', 'AARLEN', 'AARSCHOT', # ... ]
WWW::IRail::API
See perlmodinstall for information and options on installing Perl modules.
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org.
Tim Esselens <tim.esselens@gmail.com>
This software is copyright (c) 2010 by Tim Esselens.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WWW::IRail::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::IRail::API
CPAN shell
perl -MCPAN -e shell install WWW::IRail::API
For more information on module installation, please visit the detailed CPAN module installation guide.