File Coverage

blib/lib/ColorThemeBase/Static/FromObjectColors.pm
Criterion Covered Total %
statement 6 19 31.5
branch 0 8 0.0
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 33 24.2


line stmt bran cond sub pod time code
1             package ColorThemeBase::Static::FromObjectColors;
2              
3 1     1   409474 use strict 'subs', 'vars';
  1         3  
  1         71  
4             #use warnings;
5              
6 1     1   8 use parent 'ColorThemeBase::Base';
  1         2  
  1         47  
7              
8             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
9             our $DATE = '2024-07-17'; # DATE
10             our $DIST = 'ColorThemeBase-Static'; # DIST
11             our $VERSION = '0.009'; # VERSION
12              
13             sub list_items {
14 0     0 0   my $self = shift;
15 0           my @list = sort keys %{ $self->{items} };
  0            
16 0 0         wantarray ? @list : \@list;
17             }
18              
19             sub get_item_color {
20 0     0 0   my ($self, $name, $args) = @_;
21              
22 0           my $c = $self->{items}{$name};
23 0 0         return unless defined $c;
24              
25 0 0         if (ref $c eq 'CODE') {
26 0           my $c2 = $c->($self, $name, $args);
27 0 0         if (ref $c2 eq 'CODE') {
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;
37             # ABSTRACT: Base class for color theme modules with static list of items (from object's items key)
38              
39             __END__