ColorThemeBase/Static/FromObjectColors.pm

filter: Statementstmt 45.8% 11 / 24 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 2 totaltotal 34.2% 13 / 38 CC 5 SCAR 24.6
CC
5
Cov
34%
get_item_color
20.0
list_items
6.0
BEGIN
1.0
CRAP 11.8
↑ Summary ColorThemeBase/Constructor.pm »
1 package ColorThemeBase::Static::FromObjectColors;
2  
3 1 ▶use strict 'subs', 'vars';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 #use warnings;
5  
6 1 ▶use parent 'ColorThemeBase::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
9 1 our $DATE = '2024-07-17'; # DATE
10 1 our $DIST = 'ColorThemeBase-Static'; # DIST
11 1 our $VERSION = '0.009'; # VERSION
12  
13 0 ▶sub list_items {
Subroutine list_items: not called CC=2 SCAR=17.9
Pod undocumented
14 0 my $self = shift;
15 0 my @list = sort keys %{ $self->{items} };
16 0 ▶ wantarray ? @list : \@list;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
17 }
18  
19 0 ▶sub get_item_color {
Subroutine get_item_color: not called CC=4 SCAR=30.0
Pod undocumented
20 0 my ($self, $name, $args) = @_;
21  
22 0 my $c = $self->{items}{$name};
23 0 ▶ return unless defined $c;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $c 0 0 0
24  
25 0 ▶ if (ref $c eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $c eq "CODE") 0 0 0
26 0 my $c2 = $c->($self, $name, $args);
27 0 ▶ if (ref $c2 eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $c2 eq "CODE") 0 0 0
28 0 die "Color '$name' of theme $self->{orig_class} returns coderef, ".
29 "which after called still returns a coderef";
30 }
31 0 return $c2;
32 }
33 0 $c;
34 }
35  
36 1 1;
37 # ABSTRACT: Base class for color theme modules with static list of items (from object's items key)
38  
39 __END__
↑ Summary ColorThemeBase/Constructor.pm »