Avian’s Blog

Electronics and Free Software

Dark magic and scantily clad virgins

26.07.2008 14:06

Last week I uploaded my first contribution to CPAN, the Comprehensive Perl Archive Network: Net::Zemanta, an object oriented Perl binding for Zemanta services.

This means that you can now start experimenting with Zemanta in your language of choice after a simple shell one-liner like this:

$ perl -MCPAN -e "install Net::Zemanta::Suggest"

Before operating the unit carefully read the user's manual and keep it for future reference:

$ perldoc Net::Zemanta::Suggest

For the impatient, here is an example that shows how easy it is to get a list of related articles for some text:

use Net::Zemanta::Suggest;

my $zemanta = Net::Zemanta::Suggest->new(
		APIKEY => 'your-API-key' 
	);

my $suggestions = $zemanta->suggest(
		"Cozy lummox gives smart squid who asks for job pen."
	);

for $article (@{$suggestions->{articles}}) { 
	print $article->{title}, "(", $article->{url}, ")\n";
}

Surprisingly uploading this module didn't involve much dark magic at all.

Posted by Tomaž | Categories: Code
Comments
Add a new comment

Your name

Your email (optional, will be shown publicly)

Your web site (optional)


(No HTML tags allowed. Separate paragraphs with a blank line.)