line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Shorten; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
59269
|
use 5.008001; |
|
4
|
|
|
|
|
11
|
|
4
|
4
|
|
|
4
|
|
14
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
70
|
|
5
|
4
|
|
|
4
|
|
10
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
114
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
17
|
use base qw(WWW::Shorten::generic); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1661
|
|
8
|
4
|
|
|
4
|
|
17
|
use Carp (); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
624
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $DEFAULT_SERVICE = 'TinyURL'; |
11
|
|
|
|
|
|
|
our @EXPORT = qw(makeashorterlink makealongerlink); |
12
|
|
|
|
|
|
|
our $VERSION = '3.093'; |
13
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $style; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub import { |
18
|
4
|
|
|
4
|
|
36
|
my $class = shift; |
19
|
4
|
|
|
|
|
6
|
$style = shift; |
20
|
4
|
100
|
|
|
|
18
|
$style = $DEFAULT_SERVICE unless defined $style; |
21
|
4
|
|
|
|
|
11
|
my $package = "${class}::${style}"; |
22
|
4
|
|
|
|
|
6
|
eval { |
23
|
4
|
|
|
|
|
4
|
my $file = $package; |
24
|
4
|
|
|
|
|
13
|
$file =~ s/::/\//g; |
25
|
4
|
|
|
|
|
1614
|
require "$file.pm"; |
26
|
|
|
|
|
|
|
}; |
27
|
4
|
50
|
|
|
|
15
|
Carp::croak($@) if $@; |
28
|
4
|
|
|
|
|
25
|
$package->import(@_); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
WWW::Shorten - Interface to URL shortening sites. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#!/usr/bin/env perl |
40
|
|
|
|
|
|
|
use strict; |
41
|
|
|
|
|
|
|
use warnings; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
use WWW::Shorten 'TinyURL'; # Recommended |
44
|
|
|
|
|
|
|
# use WWW::Shorten 'Linkz'; # or one of the others |
45
|
|
|
|
|
|
|
# use WWW::Shorten 'Shorl'; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Individual modules have have their own syntactic variations. |
48
|
|
|
|
|
|
|
# See the documentation for the particular module you intend to use for details |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $url = 'https://metacpan.org/pod/WWW::Shorten'; |
51
|
|
|
|
|
|
|
my $short_url = makeashorterlink($url); |
52
|
|
|
|
|
|
|
my $long_url = makealongerlink($short_url); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# - OR - |
55
|
|
|
|
|
|
|
# If you don't like the long function names: |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
use WWW::Shorten 'TinyURL', ':short'; |
58
|
|
|
|
|
|
|
my $short_url = short_link($url); |
59
|
|
|
|
|
|
|
my $long_url = long_link( $short_url ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
A Perl interface to various services that shorten URLs. These sites maintain |
64
|
|
|
|
|
|
|
databases of long URLs, each of which has a unique identifier. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# DEPRECATION NOTICE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
The following shorten services have been deprecated as the endpoints no longer |
69
|
|
|
|
|
|
|
exist or function: |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item * |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
L |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
L |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
L |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
L |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
When version C<3.100> is released, these deprecated services will not be part of |
108
|
|
|
|
|
|
|
the distribution. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COMMAND LINE PROGRAM |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
A very simple program called F is supplied in the |
113
|
|
|
|
|
|
|
distribution's F folder. This program takes a URL and |
114
|
|
|
|
|
|
|
gives you a shortened version of it. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 BUGS, REQUESTS, COMMENTS |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Please submit any L you |
119
|
|
|
|
|
|
|
might have. We appreciate all help, suggestions, noted problems, and especially patches. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Note that support for extra shortening services should be released as separate modules, |
122
|
|
|
|
|
|
|
like L or L. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Support for this module is supplied primarily via the using the |
125
|
|
|
|
|
|
|
L but we also |
126
|
|
|
|
|
|
|
happily respond to issues submitted to the |
127
|
|
|
|
|
|
|
L system via the web |
128
|
|
|
|
|
|
|
or email: C |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
* https://github.com/p5-shorten/www-shorten/issues |
131
|
|
|
|
|
|
|
* http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Shorten |
132
|
|
|
|
|
|
|
* ( shorter URL: http://xrl.us/rfb ) |
133
|
|
|
|
|
|
|
* C |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 AUTHOR |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Iain Truskett C |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Alex Page -- for the original LWP hacking on which Dave based his code. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Ask Bjoern Hansen -- providing L |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Chase Whitener C |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item * |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Dave Cross dave@perlhacks.com -- Authored L on which this was based |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Eric Hammond -- writing L |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item * |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Jon and William (wjr) -- smlnk services |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Kazuhiro Osawa C |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Kevin Gilbertson (Gilby) -- TinyURL API information |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Martin Thurn -- bug fixes |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Matt Felsen (mattf) -- shorter function names |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Neil Bowers C |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
PJ Goodwin -- code for L |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item * |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Shashank Tripathi C -- for providing L |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item * |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Simon Batistoni -- giving the `makealongerlink` idea to Dave. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Everyone else we might have missed. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=back |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
In 2004 Dave Cross took over the maintenance of this distribution |
206
|
|
|
|
|
|
|
following the death of Iain Truskett. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
In 2016, Chase Whitener took over the maintenance of this distribution. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Copyright (c) 2002 by Iain Truskett. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head1 SEE ALSO |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
L, L |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=cut |