Chart/GGPlot/Theme/Functions.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 1 SCAR 6.9
CC
1
Cov
0%
theme
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Chart::GGPlot::Theme::Functions;
2  
3 # ABSTRACT: Function interface of Chart::GGPlot::Theme
4  
5 use Chart::GGPlot::Setup;
6  
7 our $VERSION = '0.002003'; # VERSION
8  
9 use Chart::GGPlot::Theme;
10 use Chart::GGPlot::Types qw(:all);
11 use Chart::GGPlot::Util qw(:all);
12  
13 use parent qw(Exporter::Tiny);
14  
15 our @EXPORT_OK = qw(theme update_theme);
16  
17 sub theme {
18 return Chart::GGPlot::Theme->new(@_);
19 }
20  
21 fun update_theme(Theme $old_theme, Theme $new_theme) {
22 # If newtheme is a "complete" theme, then it is meant to replace
23 # oldtheme; this function just returns newtheme.
24 return $new_theme if ($new_theme->complete);
25  
26 # These are elements in newtheme that aren't already set in oldtheme.
27 # They will be pulled from the default theme.
28 my $new_items = aref_diff($old_theme->names, $new_theme->names);
29 for my $name (@$new_items) {
30 $old_theme->set($name, $ggplot_global->theme_current->at($name));
31 }
32  
33 my $old_validate = $old_theme->validate;
34 my $new_validate = $new_theme->validate;
35 $old_theme->validate = ($old_validate and $new_validate);
36  
37 return $old_theme->add_theme($new_theme);
38 }
39  
40 1;
41  
42 __END__