File Coverage

blib/lib/Bot/IRC/X/WwwShorten.pm
Criterion Covered Total %
statement 11 13 84.6
branch n/a
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 15 19 78.9


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