blib/lib/Kwiki/Toolbar/List.pm

filter: Statementstmt 39.2% 20 / 51 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 35.2% 25 / 71 CC 7 SCAR 35.0
CC
7
Cov
32%
html
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 33.1
↑ Summary
1 package Kwiki::Toolbar::List;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Kwiki::Toolbar '-Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 our $VERSION = 0.01;
7  
8 #const class_id => 'toolbar';
9 1 const class_title => 'Kwiki Toolbar List';
10 1 const toolbar_template => 'toolbar_pane.html';
11 #const css_file => 'toolbar.css';
12 #const config_file => 'toolbar.yaml';
13  
14 0 ▶sub html {
Subroutine html: not called CC=7 SCAR=40.3
Pod undocumented
15 0 my $lookup = $self->hub->registry->lookup;
16 my $tools = $lookup->{toolbar}
17 0 ▶ or return '';
Branch: 1 branch
BranchTrueFalseTotal
my $tools = $lookup->{"toolbar"} or return "" 0 0 0
18 0 my %toolmap;
19 0 for (keys %$tools) {
20 0 my $array = $tools->{$_};
21 0 push @{$toolmap{$array->[0]}}, {@{$array}[1..$#{$array}]};
22 }
23 0 my %classmap = reverse %{$lookup->{classes}};
24 0 my $x = 1;
25 my %class_ids = map {
26 0 ($classmap{$_}, $x++)
27 0 } @{$self->hub->config->plugin_classes};
28 my @class_ids = grep {
29 0 delete $class_ids{$_}
30 0 } @{$self->config->toolbar_order};
31 push @class_ids, sort {
32 0 $class_ids{$a} <=> $class_ids{$b}
33 } keys %class_ids;
34 0 my @toolbar_content = ();
35 @toolbar_content = grep {
36 0 ▶ defined $_ and do {
Condition0%0/3
defined $_ && do { my $button = $_; $button =~ s/<!--.*?-->//gs; $button =~ /\S/ }
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ && do { my $button = $_; $button =~ s/<!--.*?-->//gs; $button =~ /\S/ }
defined $_ do { my $button = $_; $button =~ s/<!--.*?-->//gs; $button =~ /\S/ }
Truth table0%0/3
A && B
A= defined $_B= do { my $button = $_; $button =~ s/<!--.*?-->//gs; $button =~ /\S/ }
ABresult
0X0
100
111
37 0 my $button = $_;
38 0 $button =~ s/<!--.*?-->//gs;
39 0 $button =~ /\S/;
40 }
41 } map {
42 0 ▶ $self->show($_) ? defined($_->{template}) ? $self->template->process($_->{template}) : undef : undef
Branch: 2 branches
BranchTrueFalseTotal
$self->show($_) ? : 0 0 0
defined $_->{'template'} ? : 0 0 0
43 } map {
44 0 ▶ defined $toolmap{$_} ? @{$toolmap{$_}} : ()
Branch: 1 branch
BranchTrueFalseTotal
defined $toolmap{$_} ? : 0 0 0
45 } @class_ids;
46  
47 0 $self->template->process($self->toolbar_template,
48 toolbar_content => \@toolbar_content,
49 action => $self->hub->action,
50 );
51 }
52  
53 1 1;
54  
55 1 __DATA__
↑ Summary