Flickr-Upload-FireEagle
view release on metacpan or search on metacpan
lib/Flickr/Upload/FireEagle.pm view on Meta::CPAN
#
sub upload_request($$) {
my $self = shift;
die "$self is not a LWP::UserAgent" unless $self->isa('LWP::UserAgent');
my $req = shift;
die "expecting a HTTP::Request" unless $req->isa('HTTP::Request');
my $res = $self->request( $req );
my $tree = XML::Parser::Lite::Tree::instance()->parse($res->decoded_content());
return () unless defined $tree;
my $photoid = response_tag($tree, 'rsp', 'photoid');
my $ticketid = response_tag($tree, 'rsp', 'ticketid');
unless( defined $photoid or defined $ticketid ) {
print STDERR "upload failed:\n", $res->content(), "\n";
return undef;
}
return (defined $photoid) ? $photoid : $ticketid;
}
sub response_tag {
my $t = shift;
my $node = shift;
my $tag = shift;
return undef unless defined $t and exists $t->{'children'};
for my $n ( @{$t->{'children'}} ) {
next unless defined $n and exists $n->{'name'} and exists $n->{'children'};
next unless $n->{'name'} eq $node;
for my $m (@{$n->{'children'}} ) {
next unless exists $m->{'name'}
and $m->{'name'} eq $tag
and exists $m->{'children'};
return $m->{'children'}->[0]->{'content'};
}
}
return undef;
}
=head1 VERSION
0.1
=head1 DATE
$Date: 2008/04/22 07:01:19 $
=head1 AUTHOR
Aaron Straup Cope <ascope@cpan.org>
=head1 NOTES
Aside from requiring your own Flickr API key, secret and authentication token
you will also need similar FireEagle (OAuth) credentials. Since Flickr::Upload::FireEagle
already requires that you install the excellent I<Net::FireEagle> you should just
use the command line I<fireeagle> client for authorizing yourself with FireEagle.
=head1 SEE ALSO
L<Net::FireEagle>
L<Flickr::Upload>
L<Flickr::Upload::Dopplr>
L<Flickr::API>
L<Error>
L<http://www.fireeagle.com/>
L<http://fireeagle.yahoo.net/developer>
L<http://laughingmeme.org/2008/01/18/flickr-place-ids/>
L<http://oauth.net/>
=head1 BUGS
Sure, why not.
Please report all bugs via http://rt.cpan.org/
=head1 LICENSE
Copyright (c) 2007-2008 Aaron Straup Cope. All Rights Reserved.
This is free software. You may redistribute it and/or
modify it under the same terms as Perl itself.
=cut
return 1;
( run in 0.743 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )