ostende', date => 'tomorrow afternoon'
# JSON station lookup of all stations matching qr/oost/
print irail station => qr/oost/, dataType => 'json'
# XML vehicle lookup
print irail ve
ta.
=head1 FEATURES
=head2 Multiple output formats
The returned results can be in either XML, JSON or YAML format. You can even
select between two flavours XML (xml, XML) to suit your taste. Ofcou
e Carp qw/croak/;
use Date::Format;
use DateTime::Format::Natural;
use HTTP::Request::Common;
use JSON::XS;
use XML::Simple;
use YAML qw/freeze/;
sub make_request {
my %attr = ref $_[0] eq 'HASH
XMLout $obj, RootName=>'vehicleinformation', GroupTags => { stops => 'stop' };
/json/i and return JSON::XS->new->ascii->pretty->allow_nonref->encode($obj);
/yaml/i and return freeze $
transformed into other data formats
=over 4
=item *
xml
=item *
XML
=item *
YAML
=item *
JSON
=item *
perl (default)
=back
=head3 example of output when dataType = 'xml'
=head1 METHODS
e Carp qw/croak/;
use Date::Format;
use DateTime::Format::Natural;
use HTTP::Request::Common;
use JSON::XS;
use XML::Simple;
use YAML qw/freeze/;
sub make_request {
my %attr = ref $_[0] eq 'HASH
ns',KeepRoot => 0, GroupTags => { connections => 'connection', vias => 'via' };
/json/i and return JSON::XS->new->ascii->pretty->allow_nonref->encode($obj);
/yaml/i and return freeze $
transformed into other data formats
=over 4
=item *
xml
=item *
XML
=item *
YAML
=item *
JSON
=item *
perl (default)
=back
=head3 example of output when dataType = 'xml'
=head1 METHODS
ostende', date => 'tomorrow afternoon'
# JSON station lookup of all stations matching qr/oost/
print irail station => qr/oost/, dataType => 'json'
# XML vehicle lookup
print irail ve
ould override some internals.
my $irail = new WWW::IRail::API( client => 'LWP', dataType => 'JSON' );
=head2 lookup_stations(I<key => 'value'> | I<{key => 'value'}>)
Method which takes a string
} );
my $json_string = $irail->lookup_stations(filter => qr/./, dataType => 'JSON');
=head1 FEATURES
=head2 Multiple output formats
The returned results can be in either XML, JSON or YAML form
I::Liveboard::VERSION = '0.003';
}
use strict;
use Carp qw/croak/;
use HTTP::Request::Common;
use JSON::XS;
use XML::Simple;
use YAML qw/freeze/;
sub make_request {
my %attr = ref $_[0] eq 'HASH'
'liveboard', GroupTags => { departures => 'departure', arrivals => 'arrival' };
/json/i and return JSON::XS->new->ascii->pretty->allow_nonref->encode($obj);
/yaml/i and return freeze $
transformed into other data formats
=over 4
=item *
xml
=item *
XML
=item *
YAML
=item *
JSON
=item *
perl (default)
=back
=head3 example of output when dataType = 'xml'
<liveboard s
e Carp qw/croak/;
use Date::Format;
use DateTime::Format::Natural;
use HTTP::Request::Common;
use JSON::XS;
use XML::Simple;
use YAML qw/freeze/;
sub make_request {
my %attr = ref $_[0] eq 'HASH
turn XMLout $obj, RootName=>'stations', GroupTags => { stations => 'station' };
/json/i and return JSON::XS->new->ascii->pretty->allow_nonref->encode($obj);
/yaml/i and return freeze $
he data unnested for easier access.
=over 4
=item *
xml
=item *
XML
=item *
YAML
=item *
JSON
=item *
perl (default)
=back
=head3 example of output when dataType = 'xml'
<stations>
#!/usr/bin/perl
use Data::Dumper;
use JSON::XS;
use LWP::UserAgent;
###############################################################################
## Station Data Dumper - copyright (c) 2010 Tim Ess
# requote ident & non nums
my $json_string = $js; # js is munged to JSON now
# decode the json_strong
my $station_list = decode_json($json_string);
# map to a handy str