line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Bot::IRC plugin for automatic URL shortening |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use 5.014; |
4
|
1
|
|
|
1
|
|
334967
|
use exact; |
|
1
|
|
|
|
|
10
|
|
5
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
use WWW::Shorten qw( TinyURL makeashorterlink ); |
7
|
1
|
|
|
1
|
|
898
|
|
|
1
|
|
|
|
|
36709
|
|
|
1
|
|
|
|
|
7
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.04'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my ($bot) = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
0
|
5685
|
$bot->hook( |
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
to_me => 1, |
15
|
|
|
|
|
|
|
text => qr/^tiny\s+(?<url>\S+)/i, |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
sub { |
18
|
|
|
|
|
|
|
my ( $bot, $in, $m ) = @_; |
19
|
|
|
|
|
|
|
$bot->reply_to( makeashorterlink( $m->{url} ) ); |
20
|
0
|
|
|
0
|
|
0
|
}, |
21
|
0
|
|
|
|
|
0
|
); |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
11
|
$bot->helps( 'tiny' => 'Shorten URLs. Usage: <bot nick> tiny <url>.' ); |
24
|
|
|
|
|
|
|
} |
25
|
1
|
|
|
|
|
7
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=encoding UTF-8 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Bot::IRC::X::WwwShorten - Bot::IRC plugin for automatic URL shortening |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 VERSION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
version 1.04 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=for markdown [![test](https://github.com/gryphonshafer/Bot-IRC-X-WwwShorten/workflows/test/badge.svg)](https://github.com/gryphonshafer/Bot-IRC-X-WwwShorten/actions?query=workflow%3Atest) |
42
|
|
|
|
|
|
|
[![codecov](https://codecov.io/gh/gryphonshafer/Bot-IRC-X-WwwShorten/graph/badge.svg)](https://codecov.io/gh/gryphonshafer/Bot-IRC-X-WwwShorten) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Bot::IRC; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Bot::IRC->new( |
49
|
|
|
|
|
|
|
connect => { server => 'irc.perl.org' }, |
50
|
|
|
|
|
|
|
plugins => ['WwwShorten'], |
51
|
|
|
|
|
|
|
)->run; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This L<Bot::IRC> plugin for automatic URL shortening. It uses |
56
|
|
|
|
|
|
|
L<TinyURL|http://tinyurl.com> for shortening through L<WWW::Shorten>. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
<user> bot tiny http://perl.org |
59
|
|
|
|
|
|
|
<bot> user: http://tinyurl.com/9om78 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SEE ALSO |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
You can look for additional information at: |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=over 4 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
L<Bot::IRC> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
L<GitHub|https://github.com/gryphonshafer/Bot-IRC-X-WwwShorten> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
L<MetaCPAN|https://metacpan.org/pod/Bot::IRC::X::WwwShorten> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L<GitHub Actions|https://github.com/gryphonshafer/Bot-IRC-X-WwwShorten/actions> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L<Codecov|https://codecov.io/gh/gryphonshafer/Bot-IRC-X-WwwShorten> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L<CPANTS|http://cpants.cpanauthors.org/dist/Bot-IRC-X-WwwShorten> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L<CPAN Testers|http://www.cpantesters.org/distro/T/Bot-IRC-X-WwwShorten.html> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=for Pod::Coverage init |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Gryphon Shafer <gryphon@cpan.org> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This software is Copyright (c) 2016-2050 by Gryphon Shafer. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is free software, licensed under: |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |