Toolkit.pm

filter: Statementstmt 100% 40 / 40 Branchbran 87.5% 7 / 8 Conditioncond 71.4% 5 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 89.8% 62 / 69 CC 7 SCAR 12.9
CC
7
Cov
95%
import
7.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.6
« Toolkit/Case.pm ↑ Summary Toolkit/Case/MappedString.pm »
1 package IRC::Toolkit;
2 2 $IRC::Toolkit::VERSION = '0.092001';
3 2 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 ## Core bits can be added to this list ...
7 ## ... but removing modules will break stuff downstream
8 2 my @modules = qw/
9 Case
10 Colors
11 CTCP
12 ISupport
13 Masks
14 Modes
15 Parser
16 /;
17  
18 sub import {
19 3 ▶ my ($self, @load) = @_;
Subroutine import: called CC=7 SCAR=19.5
20 3 ▶ @load = @modules unless @load;
Branch: 1 branch
BranchTrueFalseTotal
unless @load 1 2 3
21 3 my $pkg = caller;
22 3 my @failed;
23 3 for my $mod (@load) {
24 12 my $ld = "package $pkg; use IRC::Toolkit::$mod; 1;";
25 2 ▶ eval $ld and not $@ or warn "$@\n" and push @failed, $mod;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
eval $ld and not $@ or warn "$@\n" and push @failed, $mod 3 9 12
Condition71%5/7
eval $ld && !$@ || warn("$@\n") && push(@failed, $mod)
l!l
93
eval $ld and not $@
!ll&&!rl&&r
309
warn "$@\n" and push @failed, $mod
!ll
03
MC/DC0%0/4
eval $ld && !$@ || warn("$@\n") && push(@failed, $mod)
eval $ld not $@ warn "$@\n" push @failed, $mod
Truth table14%1/7
A and not(B) || C and D
A= eval $ldB= not $@C= warn "$@\n"D= push @failed, $mod
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
26 }
27 3 ▶ confess "Failed to import ".join ' ', @failed if @failed;
Branch: 1 branch
BranchTrueFalseTotal
if @failed 2 1 3
28 1 1
29 }
30  
31 2 ▶print
Branch: 1 branch
BranchTrueFalseTotal
unless caller 0 2 2
32 qq[<Gilded> #otw also known as the "Welcome To Every Watchlist Channel"\n],
33 qq[<Capn_Refsmmat> #otw: On The Watchlist\n]
34 2 unless caller; 1;
35  
36  
37 =pod
38  
39 =head1 NAME
40  
41 IRC::Toolkit - Useful IRC objects and utilities
42  
43 =head1 SYNOPSIS
44  
45 ## Import the most commonly used Tookit:: modules
46 ## (Case, Colors, CTCP, ISupport, Masks, Modes, Parser)
47 use IRC::Toolkit;
48  
49 ## Import a list of modules:
50 use IRC::Toolkit qw/
51 CTCP
52 Masks
53 Modes
54 Numerics
55 /;
56  
57 ## ... or individually:
58 use IRC::Toolkit::Numerics;
59  
60 =head1 DESCRIPTION
61  
62 A collection of useful IRC-related utilities. See their respective
63 documentation, below.
64  
65 Modules that export functions use L<Exporter::Tiny>, which is quite flexible;
66 see the L<Exporter::Tiny> docs for details.
67  
68 L<IRC::Message::Object>; Objects representing incoming or outgoing IRC events
69  
70 L<IRC::Mode::Single>; Objects representing a single mode change
71  
72 L<IRC::Mode::Set>; Objects representing a set of mode changes
73  
74 L<IRC::Toolkit::Case>; RFC-compliant case folding tools
75  
76 L<IRC::Toolkit::Colors>; Color/format code interpolation & removal
77  
78 L<IRC::Toolkit::CTCP>; CTCP quoting and extraction tools
79  
80 L<IRC::Toolkit::ISupport>; ISUPPORT (numeric 005) parser
81  
82 L<IRC::Toolkit::Masks>; Hostmask parsing and matching tools
83  
84 L<IRC::Toolkit::Modes>; Mode-line parsing tools
85  
86 L<IRC::Toolkit::Numerics>; IRC numerics translation to/from RPL or ERR names
87  
88 L<IRC::Toolkit::Parser>; Functional interface to L<POE::Filter::IRCv3>
89  
90 L<IRC::Toolkit::TS6>; Produce sequential TS6 IDs
91  
92 L<IRC::Toolkit::Role::CaseMap>; A Role for classes that track IRC casemapping
93 settings
94  
95 =head1 SEE ALSO
96  
97 L<IRC::Utils>
98  
99 L<Parse::IRC>
100  
101 =head1 AUTHOR
102  
103 Jon Portnoy <avenj@cobaltirc.org>
104  
105 Portions of code are derived from L<IRC::Utils>, L<Net::IRC>, and
106 L<POE::Filter::IRC::Compat>, which are copyright their respective authors;
107 these items are documented where they are found.
108  
109 Licensed under the same terms as Perl.
110  
111 =cut
112  
« Toolkit/Case.pm ↑ Summary Toolkit/Case/MappedString.pm »