Net::Google::GData - Handle basic communication with Google services


Net-Google-GData documentation Contained in the Net-Google-GData distribution.

Index


Code Index:

NAME

Top

Net::Google::GData - Handle basic communication with Google services

VERSION

Top

Version 0.01

SYNOPSIS

Top

Net::Google::GData handles the basic communication details with Google services.

This module should normally only be used by modules subclassing GData.

FUNCTIONS

Top

new

Typical constructor. You can optionally pass in a hash of data to set values. Unknown data/value pairs will be silently ignored.

get

post

put

delete

PRIVATE FUNCTIONS

Top

_ua

Private method that creates and holds a LWP user agent.

Does not accept any parameters.

AUTHOR

Top

Alan Young, <alansyoungiii at gmail.com>

BUGS

Top

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

SUPPORT

Top

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

    perldoc Net::Google::GData

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Net-Google-GData

* CPAN Ratings

http://cpanratings.perl.org/d/Net-Google-GData

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Google-GData

* Search CPAN

http://search.cpan.org/dist/Net-Google-GData

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


Net-Google-GData documentation Contained in the Net-Google-GData distribution.
package Net::Google::GData;

use warnings;
use strict;

our $VERSION = '0.01';

use Carp;
use LWP::UserAgent;

use base qw( Class::Accessor  Class::ErrorHandler Net::Google::Authenticate );

__PACKAGE__->mk_accessors(qw(

));

sub new {

  my ( $class, @data ) = @_;

  my $self = bless {}, ref $class || $class;

  # Set some defaults
  $self->accountType( $self->_default_accountType )
    or croak $self->errstr;

  $self->service( $self->_default_service )
    or carp $self->errstr;

  $self->source( 'Base GData Perl Package/' . $VERSION );

  for ( my $i = 0 ; $i < @data ; $i += 2 ) {

    if ( my $method = $self->can( $data[$i] ) ) {

      $self->$method( $data[$i+1] );

    }
  }

  return $self;

}

sub GET { }
sub POST { }
sub PUT { }
sub DELETE { }

sub _ua {

  my $self = shift;

  my $ua;

  unless ( $ua = $self->SUPER::get( '_ua' ) ) {

    $ua = LWP::UserAgent->new;

    $self->SUPER::set( '_ua', $ua );

  }

  $ua->agent( $self->source );

  $self->_auth
    ? $ua->default_header( 'Authorization' => 'GoogleLogin auth=' . $self->_auth )
    : $ua->default_headers->remove_header( 'Authorization' );

  return $ua;

}

1; # End of Net::Google::GData