GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
REST::Google::Feeds(3) User Contributed Perl Documentation REST::Google::Feeds(3)

REST::Google::Feeds - OO interface to Google Feeds API

        use REST::Google::Feeds;

        REST::Google::Feeds->http_referer('http://example.com');

        my $res = REST::Google::Feeds->new('http://digg.com/rss/index.xml');

        die "response status failure" if $res->responseStatus != 200;

        my $feed = $res->responseData->feed;

        printf "title: %s\n", $feed->title;
        printf "link: %s\n", $feed->link;
        printf "description: %s\n", $feed->description;

        foreach my $e ( $feed->entries ) {
                printf "\n";
                printf "title: %s\n", $e->title;
                printf "link: %s\n", $e->link;
                printf "date published: %s\n", $e->publishedDate;
        }

"REST::Google::Feeds" provides OO interface to Google REST (aka AJAX) API for feeds.

__PACKAGE__->http_referer()
Get/set HTTP "Referer" header.

Note: Google says that you should supply a valid HTTP referer header each time you perform a request to their AJAX API, so "new()" raises warning unless referer is specified.

__PACKAGE__->new()
"q" argument should contain URL to a valid RSS or Atom feed. Please refer to 'Google Feeds AJAX API' documentation for complete list of arguments for Google Feeds service. E.g.:

        my $res = REST::Google::Feeds->new(
                q => 'http://digg.com/rss/index.xml',
        );
    

The code above will perform a following HTTP GET request:

        http://ajax.googleapis.com/ajax/services/feed/load?q=http%3A%2F%2Fdigg.com%2Frss%2Findex.xml&v=1.0
    

Note: You can left protocol version number unspecified while making your searches since "v=1.0" is passed by default.

See REST::Google "new" method.

responseData
Method returns "REST::Google::Feeds::Data" object, which has a single method "feed".

        my $res = REST::Google::Feeds->new(
                q => 'http://digg.com/rss/index.xml',
        );

        my $feed = $res->responseData->feed;
    
feed
Method returns "REST::Google::Feeds::Feed" object, which has accessors for all incapsulated data.

        my $feed = $res->responseData->feed;
        print $feed->title;
        print $feed->link;
    

Attributes of $feed are:

        title
        link
        author
        description
        type
        entries
    

Obtaining feed entries:

        foreach my $entry ($feed->entries) {
                print $entry->title;
        }
    

Attributes of $entry are:

        title
        link
        author
        publishedDate
        contentSnippet
        content
        categories
    

REST::Google - the base class for this module

<http://code.google.com/apis/ajaxfeeds/documentation/#fonje> - Google Feeds AJAX API

Copyright 2008, Eugen Sobchenko <ejs@cpan.org> and Sergey Sinkovskiy <glorybox@cpan.org>

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

2022-04-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.