Chart/WithLineDrawStyle.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 57 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::WithLineDrawStyle;
2 use Moose::Role;
3 use namespace::clean -except => qw(meta);
4  
5 around _build_dataset_traits => sub {
6 my ($next, $self, @args) = @_;
7 my $traits = $next->($self, @args);
8  
9 push @$traits, 'Google::Chart::DataSet::LineDrawStyle';
10 return $traits;
11 };
12  
13 around prepare_query => sub {
14 my ($next, $self, @args) = @_;
15 my @query = $next->($self, @args);
16  
17 my $datasets = $self->get_datasets;
18 my $max = $#$datasets;
19 my @chm;
20 for my $i (0..$max) {
21 my $dataset = $datasets->[$i];
22 if ($dataset->has_point ||
23 $dataset->has_size ||
24 $dataset->has_priority ) {
25 push @chm, join(',', 'D', $dataset->color, $i, $dataset->point, $dataset->size, $dataset->priority);
26 }
27 }
28  
29 if (@chm) {
30 push @query, (chm => join('|', @chm));
31 }
32  
33 return @query;
34 };
35  
36 package # hide from PAUSE
37 Google::Chart::DataSet::LineDrawStyle;
38 use Moose::Role;
39 use Moose::Util::TypeConstraints;
40 use namespace::clean -except => qw(meta);
41  
42 has point => (
43 is => 'ro',
44 isa => 'Int',
45 predicate => 'has_point',
46 );
47  
48 has size => (
49 is => 'ro',
50 isa => 'Int',
51 predicate => 'has_size',
52 );
53  
54 has priority => (
55 is => 'ro',
56 isa => enum([ 1, 0, -1 ]),
57 predicate => 'has_priority',
58 );
59  
60 1;
61  
62 __END__