Perl Module for use with Yourls Released

CamelI wanted to put an image of the Perl Camel up on this post but it would have required getting permission from O’Reilly to do so. Hence, I decided to use this beautiful picture by angeloux.

I just got around to finishing the alpha version of WWW::Shorten::Yourls which is a simple Perl module to shorten URLs using the open source Yourls.org project.

You can take a look at the code at GitHub or install the code using CPAN.


#! /usr/local/bin/perl
#
# LICENSE: This code is licensed under the same license as Perl itself
#
##############################################
use WWW::Shorten::Yourls;

my $url = "http://www.teknatus.com";
my $uid = "userid_for_yourls_install";
my $passwd = "password_for_yourls_install";
my $base = "base_url_for_yoursl_install";

my $yourls = WWW::Shorten::Yourls->new(URL => $url,
USER => $uid,
PASSWORD => $passwd,
BASE => $base);

print $yourls;

my $yourl = makeashorterlink($url,$uid,$passwd,$base);
print $yourl;

1;

Do let me know what you think.

Related Posts:

Twitter Opens up OAuth, Where’s Perl?

Twitter opened up their OAuth implementation last week. It’s a much welcome aspect of working with Twitter’s API since we’re planning on implementing some functionality into Semblr that uses Twitter. Hence, understanding OAuth and prototyping it’s use was important for us.

My problem with Twitter’s implementation is that the documentation is sparse and there isn’t a single example in Perl or Java. Maybe these two languages aren’t cool enough to warrant examples but to me, they’re important because they’re all I know. I spent some time over the last few days trying to implement OAuth for Twitter in my Perl scripts. The example below is a bit messy but it works.

It will create a few temp files, request a token for you, ask you to go to the URL printed to authorize the application. When you’ve authorized the application, run the script again and it will allow you to submit a status update.

Continue reading “Twitter Opens up OAuth, Where’s Perl?”

Related Posts: