blib/lib/WWW/Shorten/LYTN.pm untested

filter: Statementstmt 0.0% 0 / 30 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 46 CC 1 SCAR 6.9
CC
1
Cov
0%
makeashorterlink
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # $Id$
2  
3 =head1 NAME
4  
5 WWW::Shorten::LYTN - Perl interface to LYTN
6  
7 =head1 SYNOPSIS
8  
9 use WWW::Shorten::LYTN;
10 use WWW::Shorten 'LYTN';
11  
12 $short_url = makeashorterlink($long_url);
13  
14 =head1 DESCRIPTION
15  
16 A Perl interface to the web site lytn.it. lytn simply maintains
17 a database of long URLs, each of which has a unique identifier. lytn.it
18 will also track how many hits a URL recieves, but this feature is currently
19 unavailable.
20  
21 =cut
22  
23 package WWW::Shorten::LYTN;
24  
25 use 5.006;
26 use strict;
27 use warnings;
28 use Carp qw(croak carp);
29 use LWP::Simple;
30 use WWW::Shorten::generic;
31 use Exporter;
32 use base qw( WWW::Shorten::generic Exporter );
33 our @EXPORT = qw( makeashorterlink );
34  
35  
36 =head1 Functions
37  
38 =head2 makeashorterlink
39  
40 The function C<makeashorterlink> will call the lytn web site passing
41 it your long URL and will return the shorter lytn version.
42  
43 =cut
44  
45 sub makeashorterlink {
46 my $url = shift or croak 'No URL passed to makeashorterlink';
47 my $alias = get("http://lytn.it/api.php?rel=2&link=".$url) or croak('Getting link failed.');
48 chomp $alias;
49 return $alias;
50 }
51  
52 1;
53  
54 __END__