blib/lib/POE/Component/IRC/Plugin/CoreList.pm

filter: Statementstmt 36.6% 26 / 71 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 72.7% 8 / 11 Podpod 20.0% 1 / 5 totaltotal 26.3% 35 / 133 SCAR 52.8
CC
20
Cov
24%
_corelist
110.0
S_msg
42.0
S_public
30.0
CRAP 196.6
↑ Summary
1 package POE::Component::IRC::Plugin::CoreList;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Module::CoreList;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use POE::Component::IRC::Plugin qw(:ALL);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 $VERSION = '1.02';
10  
11 3 my $cmds = qr/find|search|release|date/;
12  
13 sub new {
14 1 ▶ my $package = shift;
Subroutine new: called CC=2 SCAR=6.9
Pod documented
15 1 my %args = @_;
16 1 $args{lc $_} = delete $args{$_} for keys %args;
17 1 bless \%args, $package;
18 }
19  
20 sub PCI_register {
21 1 ▶ my ($self,$irc) = @_;
Subroutine PCI_register: called CC=1 SCAR=0.0
Pod undocumented
22 1 $irc->plugin_register( $self, 'SERVER', qw(public msg) );
23 1 return 1;
24 }
25  
26 sub PCI_unregister {
27 1 ▶ return 1;
Subroutine PCI_unregister: called CC=1 SCAR=0.0
Pod undocumented
28 }
29  
30 sub S_public {
31 0 ▶ my ($self,$irc) = splice @_, 0 , 2;
Subroutine S_public: not called CC=5 SCAR=34.0
Pod undocumented
32 0 my ($nick,$userhost) = ( split /!/, ${ $_[0] } )[0..1];
33 0 my $channel = ${ $_[1] }->[0];
34 0 my $what = ${ $_[2] };
35 0 my $mynick = $irc->nick_name();
36 0 ▶ my $cmdstr = $self->{command} || '';
Condition0%0/2
$self->{'command'} || ''
l!l
00
MC/DC0%0/1
$self->{'command'} || ''
$self->{'command'}
Truth table0%0/2
A
A= $self->{'command'}
Aresult
11
00
37 0 my ($string) = $what =~ m/^\s*\Q$mynick\E[\:\,\;\.]?\s*(.*)$/i;
38 0 ▶ return PCI_EAT_NONE unless ( $string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io );
Branch: 1 branch
BranchTrueFalseTotal
unless $string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io 0 0 0
Condition0%0/3
$string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io
!ll&&!rl&&r
000
MC/DC0%0/2
$string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io
$string $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io
Truth table0%0/3
A and B
A= $stringB= $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io
ABresult
0X0
100
111
39 0 ▶ my ( $command, $module, @args ) = ( $1 || 'release', split /\s+/, $2 );
Condition0%0/2
$1 || 'release'
l!l
00
MC/DC0%0/1
$1 || 'release'
$1
Truth table0%0/2
A
A= $1
Aresult
11
00
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 ▶ my ($self,$irc) = splice @_, 0 , 2;
Subroutine S_msg: not called CC=6 SCAR=37.4
Pod undocumented
47 0 my ($nick,$userhost) = ( split /!/, ${ $_[0] } )[0..1];
48 0 my $string = ${ $_[2] };
49 0 ▶ my $cmdstr = $self->{command} || '';
Condition0%0/2
$self->{'command'} || ''
l!l
00
MC/DC0%0/1
$self->{'command'} || ''
$self->{'command'}
Truth table0%0/2
A
A= $self->{'command'}
Aresult
11
00
50 0 ▶ return PCI_EAT_NONE unless ( $string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io );
Branch: 1 branch
BranchTrueFalseTotal
unless $string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io 0 0 0
Condition0%0/3
$string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io
!ll&&!rl&&r
000
MC/DC0%0/2
$string and $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io
$string $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io
Truth table0%0/3
A and B
A= $stringB= $string =~ /^\Q$cmdstr\E\s*(?:($cmds))?\s*(.*)/io
ABresult
0X0
100
111
51 0 ▶ my ( $command, $module, @args ) = ( $1 || 'release', split /\s+/, $2 );
Condition0%0/2
$1 || 'release'
l!l
00
MC/DC0%0/1
$1 || 'release'
$1
Truth table0%0/2
A
A= $1
Aresult
11
00
52 0 my $reply = _corelist( $command, $module, @args );
53 0 ▶ $irc->yield( ( $self->{privmsg} ? 'privmsg' : 'notice' ), $nick, $reply );
Branch: 1 branch
BranchTrueFalseTotal
$self->{'privmsg'} ? : 0 0 0
54 0 return PCI_EAT_NONE;
55 }
56  
57 sub _corelist {
58 0 ▶ my ($command,$module,@args) = @_;
Subroutine _corelist: not called CC=10 SCAR=47.0
59 # compute the reply
60 0 my $reply;
61 0 ▶ if ( $command =~ /^(?:find|search)$/i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($command =~ /^(?:find|search)$/i) { } 0 0 0
62 0 my @modules = Module::CoreList->find_modules( qr/$module/, @args );
63  
64 # shorten large response lists
65 0 ▶ @modules = (@modules[0..8], '...') if @modules > 9;
Branch: 1 branch
BranchTrueFalseTotal
if @modules > 9 0 0 0
66  
67 0 local $" = ', ';
68 0 ▶ my $where = ( @args ? " in perl @args" : '' );
Branch: 1 branch
BranchTrueFalseTotal
@args ? : 0 0 0
69 0 ▶ $reply = ( @modules
Branch: 1 branch
BranchTrueFalseTotal
@modules ? : 0 0 0
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 ▶ if ($release) {
Branch: 1 branch
BranchTrueFalseTotal
if ($release) 0 0 0
78 0 $date = $Module::CoreList::released{$release};
79 }
80 0 my $rem;
81 0 ▶ if ( Module::CoreList->can('removed_from') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("Module::CoreList"->can("removed_from")) 0 0 0
82 0 my $removed = Module::CoreList->removed_from($module);
83 0 ▶ if ( $removed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($removed) 0 0 0
84 0 my $remdate = $Module::CoreList::released{$removed};
85 0 $rem = " and removed from $removed (released on $remdate)";
86 }
87 }
88 0 ▶ $reply = $release
Branch: 2 branches
BranchTrueFalseTotal
$release ? : 0 0 0
$rem ? : 0 0 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 3 1;
98 __END__
↑ Summary