Plugin/Syntax/Highlight/CSS.pm

filter: Statementstmt 54.0% 20 / 37 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 6 / 12 Podpod n/a totaltotal 47.2% 26 / 55 CC 4 SCAR 18.6
CC
4
Cov
47%
_make_response_message
20.0
_make_default_args
2.0
_make_poco
2.0
CRAP 6.4
« Plugin/Syntax/Highlight/HTML.pm ↑ Summary Plugin/Validator/HTML.pm »
1 package POE::Component::IRC::Plugin::Syntax::Highlight::CSS;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '2.001004'; # VERSION
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use base 'POE::Component::IRC::Plugin::BasePoCoWrap';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use POE::Component::Syntax::Highlight::CSS;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 0 ▶sub _make_default_args {
Subroutine _make_default_args: not called CC=1 SCAR=6.9
15 return (
16 0 coloring => 1,
17 pastebin_trigger => '[irc_to_pastebin]',
18 response_event => 'irc_css_highlighter',
19 trigger => qr/^highlight\s*css\s+(?=\S)/i,
20 );
21 }
22  
23 0 ▶sub _make_poco {
Subroutine _make_poco: not called CC=1 SCAR=6.9
24 return POE::Component::Syntax::Highlight::CSS->spawn(
25 debug => shift->{debug},
26 0 );
27 }
28  
29 0 ▶sub _make_response_message {
Subroutine _make_response_message: not called CC=4 SCAR=30.0
30 0 my $self = shift;
31 0 my $in_ref = shift;
32  
33 0 my $prefix = '';
34 $in_ref->{_type} eq 'public'
35 0 ▶ and $prefix = (split /!/, $in_ref->{_who})[0] . ', ';
Branch: 1 branch
BranchTrueFalseTotal
$in_ref->{"_type"} eq "public" and $prefix = (split(/!/, $in_ref->{"_who"}, 0))[0] . ', ' 0 0 0
36  
37 exists $in_ref->{error}
38 0 ▶ and return "$prefix$in_ref->{error}";
Branch: 1 branch
BranchTrueFalseTotal
exists $in_ref->{"error"} and return qq[$prefix$in_ref->{"error"}] 0 0 0
39  
40 0 ▶ if ( $self->{coloring} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"coloring"}) 0 0 0
41 0 $in_ref->{out} = _css_coloring() . "\n\n\n\n$in_ref->{out}";
42 }
43  
44 0 return "$prefix see [irc_to_pastebin]$in_ref->{out}";
45 }
46  
47 0 ▶sub _message_into_response_event { 'out' }
Subroutine _message_into_response_event: not called CC=1 SCAR=6.9
48  
49 0 ▶sub _make_poco_call {
Subroutine _make_poco_call: not called CC=1 SCAR=6.9
50 0 my $self = shift;
51 0 my $data_ref = shift;
52  
53 0 my $uri = delete $data_ref->{what};
54 0 $uri =~ s/^\s+|\s+\z//g;
55  
56 $self->{poco}->parse( {
57 event => '_poco_done',
58 uri => $uri,
59 0 map +( "_$_" => $data_ref->{$_} ),
60 keys %$data_ref,
61 }
62 );
63 }
64  
65 0 ▶sub _css_coloring {
Subroutine _css_coloring: not called CC=1 SCAR=6.9
66 0 return <<'END';
67 <style type="text/css">
68 .css-code {
69 font-family: 'DejaVu Sans Mono Book', monospace;
70 color: #000;
71 background: #fff;
72 }
73 .ch-sel, .ch-p, .ch-v, .ch-ps, .ch-at {
74 font-weight: bold;
75 }
76 .ch-sel { color: #007; } /* Selectors */
77 .ch-com { /* Comments */
78 font-style: italic;
79 color: #777;
80 }
81 .ch-p { /* Properties */
82 font-weight: bold;
83 color: #000;
84 }
85 .ch-v { /* Values */
86 font-weight: bold;
87 color: #880;
88 }
89 .ch-ps { /* Pseudo-selectors and Pseudo-elements */
90 font-weight: bold;
91 color: #11F;
92 }
93 .ch-at { /* At-rules */
94 font-weight: bold;
95 color: #955;
96 }
97 .ch-n {
98 color: #888;
99 }
100 </style>
101 END
102 }
103  
104 1 1;
105 __END__
« Plugin/Syntax/Highlight/HTML.pm ↑ Summary Plugin/Validator/HTML.pm »