Chart/WithLineStyle.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 61 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Google::Chart::WithLineStyle;
2 use Moose::Role;
3 use namespace::clean -except => qw(meta);
4  
5 around _build_dataset_traits => sub {
6 my ($next, $self) = @_;
7 my $traits = $next->($self);
8 push @$traits, 'Google::Chart::DataSet::WithLineStyle';
9 return $traits;
10 };
11  
12 around prepare_query => sub {
13 my ($next, $self, @args) = @_;
14  
15 my @query = $next->($self, @args);
16  
17 my @chls;
18 my $datasets = $self->get_datasets;
19 my $max = $#$datasets;
20 for my $i (0..$max) {
21 my $dataset = $datasets->[$i];
22 if ($dataset->has_line_thickness || $dataset->has_line_segment_length || $dataset->has_blank_segment_length ) {
23 $chls[$i] = join(',',
24 map { defined $_ ? $_ : '' }
25 $dataset->line_thickness || 1,
26 $dataset->line_segment_length || 0,
27 $dataset->blank_segment_length || 0,
28 );
29 }
30 }
31  
32 if (@chls) {
33 push @query, (chls => join('|', @chls));
34 }
35 return @query;
36 };
37  
38 package # hide from PAUSE
39 Google::Chart::DataSet::WithLineStyle;
40 use Moose::Role;
41 use namespace::clean -except => qw(meta);
42  
43 has line_thickness => (
44 is => 'ro',
45 isa => 'Num',
46 predicate => 'has_line_thickness',
47 );
48  
49 has line_segment_length => (
50 is => 'ro',
51 isa => 'Num',
52 predicate => 'has_line_segment_length',
53 );
54  
55 has blank_segment_length => (
56 is => 'ro',
57 isa => 'Num',
58 predicate => 'has_blank_segment_length',
59 );
60  
61 1;
62  
63 __END__