WWW::Google::API::Base - Perl client to the Google Base API <http://code.google.com/apis/base/>
<http://code.google.com/apis/base/>
version 0.001
$Id$
use WWW::Google::API::Base; my $file_conf = LoadFile($ENV{HOME}.'/.gapi'); my $api_key = $ENV{gapi_key}; my $api_user = $ENV{gapi_user}; my $api_pass = $ENV{gapi_pass}; my $gbase = WWW::Google::API::Base->new( { auth_type => 'ProgrammaticLogin', api_key => $api_key, api_user => $api_user, api_pass => $api_pass }, { } );
$insert_entry = $gbase->insert( 'http://www.google.com/base/feeds/itemtypes/en_US/Recipes', { -title => 'He Jingxian\'s chicken', -content => "<div xmlns='http://www.w3.org/1999/xhtml'>Delectable Sichuan specialty</div>", -link => [ { rel => 'alternate', type => 'text/html', href => 'http://localhost/uniqueid' }, ], cooking_time => 30, label => [qw(foo bar baz)], main_ingredient => [qw(chicken chili peanuts)], servings => 5, }, ); $new_id = $insert_entry->id;
$update_entry = $gbase->update( $new_id, { -title => 'He Jingxian\'s chicken', -content => "<div xmlns='http://www.w3.org/1999/xhtml'>Delectable Sichuan specialty</div>", -link => [ { rel => 'alternate', type => 'text/html', href => 'http://localhost/uniqueid' }, ], cooking_time => 60, label => [qw(fio bir biz)], main_ingredient => [qw(chicken chili peanuts)], servings => 15, }, );
my $delete_response; eval { $delete_response =$gbase->delete($new_id); }; if ($@) { my $e = $@; die $e->status_line; # HTTP::Response } die "Successfully deleted if $delete_response->code == 200; # HTTP::Response
Currently only supports querying by id
my $select_inserted_entry; eval { $select_inserted_entry =$gbase->select($new_id); }; if ($@) { my $e = $@; die $e->status_line; # HTTP::Response }
To install WWW::Google::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Google::API
CPAN shell
perl -MCPAN -e shell install WWW::Google::API
For more information on module installation, please visit the detailed CPAN module installation guide.