blib/lib/Document/Writer/Page.pm

filter: Statementstmt 100% 43 / 43 Branchbran 83.3% 5 / 6 Conditioncond 55.5% 5 / 9 MC/DCmcdc 33.3% 2 / 6 Subroutinesub 100% 12 / 12 Podpod 100% 1 / 1 totaltotal 88.3% 68 / 77 CC 7 SCAR 12.6
CC
7
Cov
91%
__ANON__
7.5
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
« blib/lib/Document/Writer.pm ↑ Summary lib/Document/Writer/TextArea.pm »
1 package Document::Writer::Page;
2 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 4 extends 'Graphics::Primitive::Container';
5  
6 4 ▶use Graphics::Primitive::Insets;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Graphics::Primitive::TextBox;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Layout::Manager::Compass;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Layout::Manager::Flow;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # use Graphics::Color::RGB;
12  
13 has 'body' => (
14 is => 'rw',
15 isa => 'Graphics::Primitive::Component',
16 4 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
17 4 my ($self) = @_;
18 4 Graphics::Primitive::Container->new(
19 layout_manager => Layout::Manager::Flow->new,
20 class => 'dw-body'
21 )
22 }
23 4 );
24 4 has 'color' => (
25 is => 'rw',
26 isa => 'Graphics::Color',
27 );
28 has 'footer' => (
29 is => 'rw',
30 isa => 'Graphics::Primitive::Component',
31 4 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 4 return Graphics::Primitive::TextBox->new(
33 # text => 'Footer',
34 class => 'dw-footer'
35 )
36 }
37 4 );
38 has 'header' => (
39 is => 'rw',
40 isa => 'Graphics::Primitive::Component',
41 4 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
42 4 return Graphics::Primitive::TextBox->new(
43 # text => 'Header',
44 class => 'dw-header'
45 )
46 }
47 4 );
48 # has '+margins' => ( default => sub {
49 # Graphics::Primitive::Insets->new( left => 90, right => 90, top => 72, bottom => 72);
50 # });
51 4 ▶has '+layout_manager' => ( default => sub { Layout::Manager::Compass->new });
Subroutine __ANON__: called CC=1 SCAR=0.0
52 4 ▶has '+page' => ( default => sub { 1 });
Subroutine __ANON__: called CC=1 SCAR=0.0
53  
54 4 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod documented
55 4 my ($self) = @_;
56  
57 4 $self->add_component($self->header, 'n');
58 4 $self->add_component($self->footer, 's');
59 4 $self->add_component($self->body, 'c');
60 }
61  
62 6 ▶override('prepare', sub {
Subroutine __ANON__: called CC=7 SCAR=20.2
63 6 my ($self, $driver) = @_;
64  
65 6 ▶ if(defined($self->header) && !$self->header->minimum_width) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->header and not $self->header->minimum_width) 4 2 6
Condition66%2/3
defined $self->header and not $self->header->minimum_width
!ll&&!rl&&r
024
MC/DC50%1/2
defined $self->header and not $self->header->minimum_width
defined $self->header not $self->header->minimum_width
Truth table66%2/3
A and not(B)
A= defined $self->headerB= not $self->header->minimum_width
ABresult
0X0
100
111
66 4 $self->header->minimum_width($self->inside_width + $self->header->outside_width);
67 }
68 6 ▶ if(defined($self->footer) && !$self->footer->minimum_width) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->footer and not $self->footer->minimum_width) 4 2 6
Condition66%2/3
defined $self->footer and not $self->footer->minimum_width
!ll&&!rl&&r
024
MC/DC50%1/2
defined $self->footer and not $self->footer->minimum_width
defined $self->footer not $self->footer->minimum_width
Truth table66%2/3
A and not(B)
A= defined $self->footerB= not $self->footer->minimum_width
ABresult
0X0
100
111
69 4 $self->footer->minimum_width($self->inside_width + $self->footer->outside_width);
70 }
71 6 ▶ if(defined($self->body) && !$self->body->minimum_width) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->body and not $self->body->minimum_width) 6 0 6
Condition33%1/3
defined $self->body and not $self->body->minimum_width
!ll&&!rl&&r
006
MC/DC0%0/2
defined $self->body and not $self->body->minimum_width
defined $self->body not $self->body->minimum_width
Truth table33%1/3
A and not(B)
A= defined $self->bodyB= not $self->body->minimum_width
ABresult
0X0
100
111
72 6 $self->body->minimum_width($self->inside_width + $self->body->outside_width);
73 }
74  
75 6 super;
76 4 });
77  
78 4 __PACKAGE__->meta->make_immutable;
79  
80 4 1;
81 __END__
« blib/lib/Document/Writer.pm ↑ Summary lib/Document/Writer/TextArea.pm »