Last active
March 26, 2016 00:51
-
-
Save oliwer/d1216099b998cff5c228 to your computer and use it in GitHub Desktop.
WWW::Shorten::SCK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package WWW::Shorten::SCK; | |
# | |
# URL shortening provider for http://sck.pm | |
# | |
use strict; | |
use warnings; | |
sub new { bless {} } | |
sub shorterlink_start { | |
my ($self, $link) = @_; | |
{ GET => "http://sck.pm/?a=1&url=$link" } | |
} | |
sub shorterlink_result { | |
my ($self, $content) = @_; | |
if ($content =~ /^(http\S+)/) { | |
return $1; | |
} | |
die $content; | |
} | |
sub longerlink_start { | |
my ($self, $link) = @_; | |
$link = "http://sck.pm/$link" unless | |
$link =~ /^http/; | |
{ GET => $link } | |
} | |
sub longerlink_result { die $_[1] } | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment