EVDB::API::YAML - Use the YAML flavor of the Eventful API


EVDB-API documentation Contained in the EVDB-API distribution.

Index


Code Index:

NAME

Top

EVDB::API::YAML - Use the YAML flavor of the Eventful API

SYNOPSIS

Top

    my $evdb    = EVDB::API->new(app_key => $app_key, flavor => 'yaml');
    my $results = $evdb->call('events/get', { id => 'E0-001-001336058-5' });

DESCRIPTION

Top

Parses YAML from the Eventful API.

METHODS

Top

flavor

Return the flavor name.

ctype

Return a checkstring for the expected return content type.

parse

Parse YAML data from the Eventful API using YAML::Syck or YAML.

AUTHORS

Top

* Daniel Westermann-Clark <danieltwc@cpan.org>

LICENSE

Top

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Top

* EVDB::API
* YAML::Syck
* YAML

EVDB-API documentation Contained in the EVDB-API distribution.
package EVDB::API::YAML;

use strict;
use warnings;
use Carp;

sub flavor { 'yaml' }

sub ctype { 'yaml' }

sub parse {
    my ($class, $data, $force_array) = @_;

    carp "Forcing arrays is not supported for API flavor " . $class->flavor
        if $force_array;

    eval { require YAML::Syck };
    if ($@) {
        require YAML;
        return YAML::Load($data);
    }
    else {
        return YAML::Syck::Load($data);
    }
}

1;