OFC.pm

filter: Statementstmt 100% 56 / 56 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 98.5% 68 / 69 CC 4 SCAR 7.4
CC
4
Cov
98%
_ofc_data_lines
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.1
« OFC/Grid.pm ↑ Summary OFC/Types.pm »
1 package Chart::OFC;
2 19 $Chart::OFC::VERSION = '0.12';
3 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6  
7 19 ▶use Moose 0.56;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 19 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 19 ▶use Chart::OFC::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 19 with 'Chart::OFC::Role::OFCDataLines';
12  
13 19 has title =>
14 ( is => 'ro',
15 isa => 'Str',
16 predicate => '_has_title',
17 );
18  
19 19 has title_style =>
20 ( is => 'ro',
21 isa => 'Str',
22 default => 'font-size: 25px',
23 );
24  
25 19 has tool_tip =>
26 ( is => 'ro',
27 isa => 'Str',
28 predicate => '_has_tool_tip',
29 );
30  
31 19 has bg_color =>
32 ( is => 'ro',
33 isa => 'Chart::OFC::Type::Color',
34 coerce => 1,
35 predicate => '_has_bg_color',
36 );
37  
38 {
39 19 my $CRLF = "\r\n";
40 sub as_ofc_data
41 8 ▶ {
Subroutine as_ofc_data: called CC=1 SCAR=0.0
Pod documented
42 8 my $self = shift;
43  
44 8 my @lines = $self->_ofc_data_lines();
45  
46 8 return join '', map { $_ . $CRLF } @lines;
47 }
48 }
49  
50 sub _ofc_data_lines
51 19 ▶{
Subroutine _ofc_data_lines: called CC=4 SCAR=13.9
52 8 my $self = shift;
53  
54 8 my @lines;
55  
56 8 ▶ push @lines, $self->_data_line( 'title', $self->title(), '{ ' . $self->title_style() . ' }' )
Branch: 1 branch
BranchTrueFalseTotal
if $self->_has_title 8 0 8
57 if $self->_has_title();
58  
59 8 for my $key ( qw( tool_tip bg_color ) )
60 {
61 16 my $pred = '_has_' . $key;
62  
63 16 ▶ push @lines, $self->_data_line( $key, $self->$key() )
Branch: 1 branch
BranchTrueFalseTotal
if $self->$pred 3 13 16
64 if $self->$pred();
65 }
66  
67 8 return @lines;
68 }
69  
70 # Moose gets weird if these things are loaded before various subs are
71 # defined.
72  
73 # If these requires are changed to a use some tests start failing in
74 # weird ways. WTF?
75  
76 19 require Chart::OFC::Grid;
77 19 require Chart::OFC::Pie;
78  
79 19 require Chart::OFC::AxisLabel;
80 19 require Chart::OFC::XAxis;
81 19 require Chart::OFC::YAxis;
82  
83 19 require Chart::OFC::Dataset::3DBar;
84 19 require Chart::OFC::Dataset::Area;
85 19 require Chart::OFC::Dataset::Bar;
86 19 require Chart::OFC::Dataset::Candle;
87 19 require Chart::OFC::Dataset::FadeBar;
88 19 require Chart::OFC::Dataset::OutlinedBar;
89 19 require Chart::OFC::Dataset::GlassBar;
90 19 require Chart::OFC::Dataset::HighLowClose;
91 19 require Chart::OFC::Dataset::Line;
92 19 require Chart::OFC::Dataset::LineWithDots;
93 19 require Chart::OFC::Dataset::Scatter;
94 19 require Chart::OFC::Dataset::SketchBar;
95  
96 19 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 19 __PACKAGE__->meta()->make_immutable();
99  
100 19 1;
101  
102 # ABSTRACT: Generate data files for use with Open Flash Chart
103  
104 __END__
« OFC/Grid.pm ↑ Summary OFC/Types.pm »