Robin Clarke > Google-Fusion-0.10 > Google::Fusion

Download:
Google-Fusion-0.10.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.10   Source  

NAME ^

Google::Fusion - Interface to the Google Fusion Tables API

VERSION ^

Version 0.10

SYNOPSIS ^

  my $fusion = Google::Fusion->new( 
    client_id       => $client_id,
    client_secret   => $client_secret,
    token_store     => $token_store,
    );

  # Get the result for a query
  my $result = $fusion->query( $sql );
  
  # Print out the rows returned
  foreach( @{ $result->rows } ){
      print join( ',', @{ $_ } ) . "\n";
  }

PARAMS/ACCESSORS ^

One of the following combination of parameters is required:

    client_id and client_secret

You will be prompted with a URL, with which you will atain an access_code.

    client_id, client_secret, access_code

The OAuth2 client will complete the authorization process for you and get the refresh_token and access_token for you

    refresh_token and optionally access_token

The OAuth2 client will get a valid access_token for you if necessary, and refresh it when necessary.

    access_token

You will be able to make requests as long as the access_token is valid.

METHODS ^

query

Submit a (Googley) SQL query. Single argument is the SQL. Return is a Google::Fusion::Result object

Example:

    my $result = $fusion->query( 'SELECT * FROM 123456' );

get_fresh_access_token

Force the OAuth access token to be refreshed

Example:

    $fusion->get_fresh_access_token();

add_to_insert_buffer

The Fusion Table intefrace allows multiple INSERT commands to be sent in one query. This can be used similarly to the query method, but and will reduce the number of queries you use.

# Get data from your local database $sth->execute(); while( my $row = $sth->fetchrow_hashref ){ $fusion->add_to_insert_buffer( sprintf( "INSERT INTO INTO 12345 ( Id, Text ) VALUES( '%s', '%s' )", $row->{Id}, $row->{Text} ) ); } $fusion->send_insert_buffer;

Obviously this can be further optimised by having many VALUES per INSERT.

If a send_insert_buffer was triggered during the add, this is returned, otherwise undef is returned

send_insert_buffer

Flush the rest of the insert buffer

AUTHOR ^

Robin Clarke, <perl at robinclarke.net>

BUGS ^

Please report any bugs or feature requests to bug-google-fusion at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Google-Fusion. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Google::Fusion

You can also look for information at:

ACKNOWLEDGEMENTS ^

LICENSE AND COPYRIGHT ^

Copyright 2011 Robin Clarke.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: