Plugin/Syntax/Highlight/HTML.pm

filter: Statementstmt 45.1% 14 / 31 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 4 / 10 Podpod n/a totaltotal 38.3% 18 / 47 CC 4 SCAR 19.8
CC
4
Cov
38%
_make_response_message
20.0
_make_default_args
2.0
_make_poco
2.0
CRAP 7.2
« Plugin/WWW/Cache/Google.pm ↑ Summary Plugin/Syntax/Highlight/CSS.pm »
1 package POE::Component::IRC::Plugin::Syntax::Highlight::HTML;
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 base 'POE::Component::IRC::Plugin::BasePoCoWrap';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use POE::Component::Syntax::Highlight::HTML;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 0 ▶sub _make_default_args {
Subroutine _make_default_args: not called CC=1 SCAR=6.9
12 return (
13 0 coloring => 1,
14 pastebin_trigger => '[irc_to_pastebin]',
15 response_event => 'irc_html_highlighter',
16 trigger => qr/^highlight\s*html\s+(?=\S)/i,
17 );
18 }
19  
20 0 ▶sub _make_poco {
Subroutine _make_poco: not called CC=1 SCAR=6.9
21 return POE::Component::Syntax::Highlight::HTML->spawn(
22 debug => shift->{debug},
23 0 );
24 }
25  
26 0 ▶sub _make_response_message {
Subroutine _make_response_message: not called CC=4 SCAR=30.0
27 0 my $self = shift;
28 0 my $in_ref = shift;
29  
30 0 my $prefix = '';
31 $in_ref->{_type} eq 'public'
32 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
33  
34 exists $in_ref->{error}
35 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
36  
37 0 ▶ if ( $self->{coloring} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"coloring"}) 0 0 0
38 0 $in_ref->{out} = _css_coloring() . "\n\n\n\n$in_ref->{out}";
39 }
40  
41 0 return "$prefix see [irc_to_pastebin]$in_ref->{out}";
42 }
43  
44 0 ▶sub _message_into_response_event { 'out' }
Subroutine _message_into_response_event: not called CC=1 SCAR=6.9
45  
46 0 ▶sub _make_poco_call {
Subroutine _make_poco_call: not called CC=1 SCAR=6.9
47 0 my $self = shift;
48 0 my $data_ref = shift;
49  
50 0 my $uri = delete $data_ref->{what};
51 0 $uri =~ s/^\s+|\s+\z//g;
52  
53 $self->{poco}->parse( {
54 event => '_poco_done',
55 uri => $uri,
56 0 map +( "_$_" => $data_ref->{$_} ),
57 keys %$data_ref,
58 }
59 );
60 }
61  
62 0 ▶sub _css_coloring {
Subroutine _css_coloring: not called CC=1 SCAR=6.9
63 0 return <<'END';
64 <style type="text/css">
65 .h-decl { color: #336699; font-style: italic; } /* doctype declaration */
66 .h-pi { color: #336699; } /* process instruction */
67 .h-com { color: #338833; font-style: italic; } /* comment */
68 .h-ab { color: #000000; font-weight: bold; } /* angles as tag delim. */
69 .h-tag { color: #993399; font-weight: bold; } /* tag name */
70 .h-attr { color: #000000; font-weight: bold; } /* attribute name */
71 .h-attv { color: #333399; } /* attribute value */
72 .h-ent { color: #cc3333; } /* entity */
73  
74 .h-lno { color: #aaaaaa; background: #f7f7f7;} /* line numbers */
75 </style>
76 END
77 }
78  
79  
80 1 1;
81 __END__
« Plugin/WWW/Cache/Google.pm ↑ Summary Plugin/Syntax/Highlight/CSS.pm »