line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::IRC::Plugin::CoreList; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
837408
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
86
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
5
|
2
|
|
|
2
|
|
7641
|
use Module::CoreList; |
|
2
|
|
|
|
|
174909
|
|
|
2
|
|
|
|
|
27
|
|
6
|
2
|
|
|
2
|
|
2660
|
use POE::Component::IRC::Plugin qw(:ALL); |
|
2
|
|
|
|
|
577
|
|
|
2
|
|
|
|
|
464
|
|
7
|
2
|
|
|
2
|
|
14
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
2318
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = '1.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $cmds = qr/find|search|release|date/; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
1
|
|
|
1
|
1
|
7354
|
my $package = shift; |
15
|
1
|
|
|
|
|
4
|
my %args = @_; |
16
|
1
|
|
|
|
|
8
|
$args{lc $_} = delete $args{$_} for keys %args; |
17
|
1
|
|
|
|
|
6
|
bless \%args, $package; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub PCI_register { |
21
|
1
|
|
|
1
|
0
|
367
|
my ($self,$irc) = @_; |
22
|
1
|
|
|
|
|
6
|
$irc->plugin_register( $self, 'SERVER', qw(public msg) ); |
23
|
1
|
|
|
|
|
45
|
return 1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub PCI_unregister { |
27
|
1
|
|
|
1
|
0
|
2329
|
return 1; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub S_public { |
31
|
0
|
|
|
0
|
0
|
|
my ($self,$irc) = splice @_, 0 , 2; |
32
|
0
|
|
|
|
|
|
my ($nick,$userhost) = ( split /!/, ${ $_[0] } )[0..1]; |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $channel = ${ $_[1] }->[0]; |
|
0
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $what = ${ $_[2] }; |
|
0
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $mynick = $irc->nick_name(); |
36
|
0
|
|
0
|
|
|
|
my $cmdstr = $self->{command} || ''; |
37
|
0
|
|
|
|
|
|
my ($string) = $what =~ m/^\s*\Q$mynick\E[\:\,\;\.]?\s*(.*)$/i; |
38
|
0
|
0
|
0
|
|
|
|
return PCI_EAT_NONE unless ( $string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io ); |
39
|
0
|
|
0
|
|
|
|
my ( $command, $module, @args ) = ( $1 || 'release', split /\s+/, $2 ); |
40
|
0
|
|
|
|
|
|
my $reply = _corelist( $command, $module, @args ); |
41
|
0
|
|
|
|
|
|
$irc->yield( 'privmsg', $channel, $reply ); |
42
|
0
|
|
|
|
|
|
return PCI_EAT_NONE; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub S_msg { |
46
|
0
|
|
|
0
|
0
|
|
my ($self,$irc) = splice @_, 0 , 2; |
47
|
0
|
|
|
|
|
|
my ($nick,$userhost) = ( split /!/, ${ $_[0] } )[0..1]; |
|
0
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $string = ${ $_[2] }; |
|
0
|
|
|
|
|
|
|
49
|
0
|
|
0
|
|
|
|
my $cmdstr = $self->{command} || ''; |
50
|
0
|
0
|
0
|
|
|
|
return PCI_EAT_NONE unless ( $string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io ); |
51
|
0
|
|
0
|
|
|
|
my ( $command, $module, @args ) = ( $1 || 'release', split /\s+/, $2 ); |
52
|
0
|
|
|
|
|
|
my $reply = _corelist( $command, $module, @args ); |
53
|
0
|
0
|
|
|
|
|
$irc->yield( ( $self->{privmsg} ? 'privmsg' : 'notice' ), $nick, $reply ); |
54
|
0
|
|
|
|
|
|
return PCI_EAT_NONE; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _corelist { |
58
|
0
|
|
|
0
|
|
|
my ($command,$module,@args) = @_; |
59
|
|
|
|
|
|
|
# compute the reply |
60
|
0
|
|
|
|
|
|
my $reply; |
61
|
0
|
0
|
|
|
|
|
if ( $command =~ /^(?:find|search)$/i ) { |
62
|
0
|
|
|
|
|
|
my @modules = Module::CoreList->find_modules( qr/$module/, @args ); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# shorten large response lists |
65
|
0
|
0
|
|
|
|
|
@modules = (@modules[0..8], '...') if @modules > 9; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
local $" = ', '; |
68
|
0
|
0
|
|
|
|
|
my $where = ( @args ? " in perl @args" : '' ); |
69
|
0
|
0
|
|
|
|
|
$reply = ( @modules |
70
|
|
|
|
|
|
|
? "Found @modules" |
71
|
|
|
|
|
|
|
: "Found no module matching /$module/" ) |
72
|
|
|
|
|
|
|
. $where; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
else { |
75
|
0
|
|
|
|
|
|
my ( $release, $patchlevel, $date ) |
76
|
|
|
|
|
|
|
= ( Module::CoreList->first_release($module), '', '' ); |
77
|
0
|
0
|
|
|
|
|
if ($release) { |
78
|
0
|
|
|
|
|
|
$date = $Module::CoreList::released{$release}; |
79
|
|
|
|
|
|
|
} |
80
|
0
|
|
|
|
|
|
my $rem; |
81
|
0
|
0
|
|
|
|
|
if ( Module::CoreList->can('removed_from') ) { |
82
|
0
|
|
|
|
|
|
my $removed = Module::CoreList->removed_from($module); |
83
|
0
|
0
|
|
|
|
|
if ( $removed ) { |
84
|
0
|
|
|
|
|
|
my $remdate = $Module::CoreList::released{$removed}; |
85
|
0
|
|
|
|
|
|
$rem = " and removed from $removed (released on $remdate)"; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
0
|
0
|
|
|
|
|
$reply = $release |
|
|
0
|
|
|
|
|
|
89
|
|
|
|
|
|
|
? "$module was first released with perl $release (" |
90
|
|
|
|
|
|
|
. "released on $date)" |
91
|
|
|
|
|
|
|
. ( $rem ? $rem : '' ) |
92
|
|
|
|
|
|
|
: "$module is not in the core"; |
93
|
|
|
|
|
|
|
} |
94
|
0
|
|
|
|
|
|
return $reply; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
__END__ |