line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Bot::IRC plugin to parse and print URI titles |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use 5.014; |
4
|
1
|
|
|
1
|
|
302258
|
use exact; |
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
use LWP::UserAgent; |
7
|
1
|
|
|
1
|
|
1110
|
use LWP::Protocol::https; |
|
1
|
|
|
|
|
30678
|
|
|
1
|
|
|
|
|
33
|
|
8
|
1
|
|
|
1
|
|
401
|
use Text::Unidecode 'unidecode'; |
|
1
|
|
|
|
|
9035
|
|
|
1
|
|
|
|
|
43
|
|
9
|
1
|
|
|
1
|
|
452
|
use URI::Title 'title'; |
|
1
|
|
|
|
|
1012
|
|
|
1
|
|
|
|
|
56
|
|
10
|
1
|
|
|
1
|
|
355
|
|
|
1
|
|
|
|
|
14879
|
|
|
1
|
|
|
|
|
279
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.05'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my ($bot) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
0
|
5204
|
$bot->hook( |
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
command => 'PRIVMSG', |
18
|
|
|
|
|
|
|
text => qr|https?://\S+|, |
19
|
|
|
|
|
|
|
}, |
20
|
|
|
|
|
|
|
sub { |
21
|
|
|
|
|
|
|
my ( $bot, $in, $m ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
|
|
my %urls; |
24
|
|
|
|
|
|
|
$urls{$1} = 1 while ( $in->{text} =~ m|(https?://\S+)|g ); |
25
|
0
|
|
|
|
|
|
$bot->reply("[ $_ ]") for ( grep { defined } map { unidecode( title($_) ) } keys %urls ); |
26
|
0
|
|
|
|
|
|
return; |
27
|
0
|
|
|
|
|
|
}, |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
} |
30
|
1
|
|
|
|
|
14
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=pod |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=encoding UTF-8 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Bot::IRC::X::UriTitle - Bot::IRC plugin to parse and print URI titles |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 VERSION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
version 1.05 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=for markdown [![test](https://github.com/gryphonshafer/Bot-IRC-X-UriTitle/workflows/test/badge.svg)](https://github.com/gryphonshafer/Bot-IRC-X-UriTitle/actions?query=workflow%3Atest) |
47
|
|
|
|
|
|
|
[![codecov](https://codecov.io/gh/gryphonshafer/Bot-IRC-X-UriTitle/graph/badge.svg)](https://codecov.io/gh/gryphonshafer/Bot-IRC-X-UriTitle) |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use Bot::IRC; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Bot::IRC->new( |
54
|
|
|
|
|
|
|
connect => { server => 'irc.perl.org' }, |
55
|
|
|
|
|
|
|
plugins => ['UriTitle'], |
56
|
|
|
|
|
|
|
)->run; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This L<Bot::IRC> plugin makes the bot parse and print URI titles. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SEE ALSO |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
You can look for additional information at: |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=over 4 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L<Bot::IRC> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
L<GitHub|https://github.com/gryphonshafer/Bot-IRC-X-UriTitle> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
L<MetaCPAN|https://metacpan.org/pod/Bot::IRC::X::UriTitle> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
L<GitHub Actions|https://github.com/gryphonshafer/Bot-IRC-X-UriTitle/actions> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
L<Codecov|https://codecov.io/gh/gryphonshafer/Bot-IRC-X-UriTitle> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L<CPANTS|http://cpants.cpanauthors.org/dist/Bot-IRC-X-UriTitle> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
L<CPAN Testers|http://www.cpantesters.org/distro/T/Bot-IRC-X-UriTitle.html> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=for Pod::Coverage init |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Gryphon Shafer <gryphon@cpan.org> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is Copyright (c) 2016-2050 by Gryphon Shafer. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software, licensed under: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |