perl

Contributed Perl Client

By vineet

Aaron Straup Cope has written a DayPI Client in Perl to talk to the Daylife API. Thanks to Aaron for making this available. More details below.

NAME
    Net::Daylife - OOP for the Daylife.com API

SYNOPSIS
     use Getopt::Std;
     use Net::Daylife;

     my %opts = ();
     getopts('c:', \%opts);

     my $day = Net::Daylife->new('config' => $opts{'c'});

     my $res = $day->api_call('search_getRelatedArticles', {'query' => 'flickr'});

     foreach my $a ($res->findnodes("/response/payload/article")){
            print $a->findvalue("headline") . "\n";
     }

DESCRIPTION
    Net::Daylife is an OOP wrapper for the Daylife.com API.

    Rather than try to mirror the API itself with individual object methods
    it exposes one principle method called...you guessed it, *api_call* that
    accepts an API method name and its arguments as a hash reference.

    API results are returned in a format specific handler. For example, XML
    responses are returned as *XML::XPath* objects, JSON responses as
    *JSON::Any* objects and so on.

    Currently only HTTP level errors are handled. API specific errors are
    left to the developer. At some point I may add format specific packages
    (Net::Daylife::XML, etc.) at which point it will make more sense to
    check response codes automagically.
Filed Under: