Haz clic en la imagen para verla a su tamaño original.
Wanted to give a try to both the Flickr::API and the Flickr::Upload Perl modules. Unfortunately right now they are not packaged for Debian. I have more or less tried CPAN before, in order to download and compile Perl modules and their dependencies automagically. But somebody talked to me about dh-make-perl calling it a nice and clean solution, so I have researched for a while.
dh-make-perl will create the files required to build a debian source package out of a perl package. This works for most simple packages and is also useful for getting started with packaging perl modules. Given a perl package name, it can also automatically download it from CPAN.
First sudo apt-get install dh-make-perl and apt-file. It's very convenient to install this latest one and to sudo apt-file update before trying anything else. Thus dh-make-perl will add to the packages created correct information about dependencies so all needed Perl modules are available when installing your own. Simply run:
$ dh-make-perl --build --cpan Flickr::API
And it will download the module sources from CPAN and create the packages libflickr-api-perl_0.03-1_all.deb and libflickr-api-perl_0.03.orig.tar.gz. One can check dependencies are also correctly generated by doing:
$ dpkg -I libflickr-api-perl_0.03-1_all.deb | grep ^\ Depends
Depends: perl (>= 5.6.0-16), libwww-perl, liburi-perl
So if right now it's tried:
$ sudo dpkg -i /home/kurtz/libflickr-api-perl_0.03-1_all.deb
It could fail telling that libwww-perl or liburi-perl are not installed. But now one can simply sudo apt-get -f install, and they all would be downloaded, installed, and then libflickr-api-perl configured.
Let's try this simple request.pl code:
#!/usr/bin/perl
use Flickr::API;
use Flickr::API::Request;
my $api = new Flickr::API({'key' => 'your_api_key'});
my $request = new Flickr::API::Request({
'method' => 'flickr.test.echo',
'args' => {},
});
my $response = $api->execute_request($request);
$ ./request.pl
Can't locate XML/Parser/Lite/Tree.pm in @INC (...)
This was expected, as XML::Parser::Lite::Tree is nor available as a Debian package. But now we know what to do when this happens:
$ dh-make-perl --build --cpan XML::Parser::Lite::Tree
$ sudo dpkg -i /home/kurtz/libxml-parser-lite-tree-perl_0.03-1_all.deb
$ sudo apt-get -f install
So the needed libsoap-lite-perl and libxml-parser-perl are also installed. Then:
$ ./request.pl
$
Everything works as expected.
Right now making the other wanted module available is a joy:
$ dh-make-perl --build --cpan Flickr::Upload
$ sudo dpkg -i /home/kurtz/libflickr-upload-perl_1.06-1_all.deb
You can try this simple upload.pl applet to check this one also works:
#!/usr/bin/perl
use LWP::UserAgent;
use Flickr::Upload qw(upload);
my $ua = LWP::UserAgent->new;
upload(
$ua,
'photo' => '/tmp/image.jpg',
'email' => 'mail@my.provider',
'password' => 'password',
'tags' => 'me myself eye',
'is_public' => 1,
'is_friend' => 1,
'is_family' => 1
) or die "Failed to upload /tmp/image.jpg";
$ ./upload.pl
Failed to upload /tmp/image.jpg at ./upload.pl line 7.
More funny Flickr and Perl stuff will follow! :)))
no es pq esté vaga para escribir ,pero el ingles y yo.....mu malllll,lo del flickr ya es q ni te lo cuento.
un besote.