| WWW-YouTube documentation | Contained in the WWW-YouTube distribution. |
WWW::YouTube::GData - Handle basic communication with Google services
Version 0.01
WWW::YouTube::GData handles the basic communication details with Google services.
This module should normally only be used by modules subclassing GData.
Typical constructor. You can optionally pass in a hash of data to set values. Unknown data/value pairs will be silently ignored.
Private method that creates and holds a LWP user agent.
Does not accept any parameters.
Eric R. Meyers, <Eric.R.Meyers@gmail.com>
Please report any bugs or feature requests to
bug-net-google-gdata at rt.cpan.org, or through the web interface at
htp://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-YouTube-GData.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc WWW::YouTube::GData
You can also look for information at:
Copyright 2008 Eric R. Meyers <Eric.R.Meyers@gmail.com>, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| WWW-YouTube documentation | Contained in the WWW-YouTube distribution. |
package WWW::YouTube::GData; use warnings; use strict;
#our $VERSION = '0.01'; #For CVS , use following line our $VERSION=sprintf("%d.%04d", q$Revision: 2008.0728 $ =~ /(\d+)\.(\d+)/);
use Carp; use LWP::UserAgent; use base qw( Class::Accessor Class::ErrorHandler WWW::YouTube::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( 'YouTube 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 _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 WWW::YouTube::GData