TableX/Column.pm

filter: Statementstmt 63.0% 29 / 46 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod 100% 3 / 3 totaltotal 61.5% 40 / 65 SCAR 24.2
CC
7
Cov
56%
__ANON__
12.0
get_reg_width
12.0
get_min_width
3.8
CRAP 11.2
« TableX/Row.pm ↑ Summary TableX/Stylable.pm »
1 package PDF::TableX::Column;
2  
3 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use MooseX::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 ▶use PDF::TableX::Types qw/StyleDefinition/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use PDF::TableX::Cell;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 with 'PDF::TableX::Stylable';
10  
11 8 has rows => (is => 'ro', isa => 'Int', default => 0);
12 8 has width => (is => 'rw', isa => 'Num');
13  
14 8 ▶use overload '@{}' => sub { return $_[0]->{_children} }, fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
15  
16 around 'width' => sub {
17 0 ▶ my $orig = shift;
Subroutine __ANON__: not called CC=3 SCAR=24.8
18 0 my $self = shift;
19 0 ▶ return $self->$orig() unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
20 0 for (@{ $self->{_children} }) { $_->width(@_) };
21 0 $self->$orig(@_);
22 0 return $self;
23 8 };
24  
25 sub add_cell {
26 146 ▶ my ($self, $cell) = @_;
Subroutine add_cell: called CC=1 SCAR=0.0
Pod documented
27 146 push @{$self->{_children}}, $cell;
28 }
29  
30 sub get_min_width {
31 6 ▶ my ($self) = @_;
Subroutine get_min_width: called CC=3 SCAR=13.3
Pod documented
32 6 my $width = 0;
33 6 for my $cell_min_width ( map {$_->min_width} @{$self->{_children}} ) {
34 0 ▶ $width = $cell_min_width if ($cell_min_width > $width);
Branch: 1 branch
BranchTrueFalseTotal
if $cell_min_width > $width 0 0 0
35 }
36 0 return $width;
37 }
38  
39 sub get_reg_width {
40 0 ▶ my ($self) = @_;
Subroutine get_reg_width: not called CC=3 SCAR=24.8
Pod documented
41 0 my $width = 0;
42 0 for my $cell_reg_width ( map {$_->reg_width} @{$self->{_children}} ) {
43 0 ▶ $width = $cell_reg_width if ($cell_reg_width > $width);
Branch: 1 branch
BranchTrueFalseTotal
if $cell_reg_width > $width 0 0 0
44 }
45 0 return $width;
46 }
47  
48 8 1;
49  
50 =head1 NAME
51  
52 PDF::TableX::Column
53  
54 =head1 VERSION
55  
56 Version 0.01
57  
58 =head1 SYNOPSIS
59  
60 =head1 METHODS
61  
62 =head2 add_cell
63  
64 TODO
65  
66 =head2 get_min_width
67  
68 TODO
69  
70 =head2 get_reg_width
71  
72 TODO
73  
74 =head1 AUTHOR
75  
76 Grzegorz Papkala, C<< <grzegorzpapkala at gmail.com> >>
77  
78 =head1 BUGS
79  
80 Please report any bugs or feature requests at: L<https://github.com/grzegorzpapkala/PDF-TableX/issues>
81  
82 =head1 SUPPORT
83  
84 PDF::TableX is hosted on GitHub L<https://github.com/grzegorzpapkala/PDF-TableX>
85  
86 =head1 ACKNOWLEDGEMENTS
87  
88 =head1 COPYRIGHT & LICENSE
89  
90 Copyright 2013 Grzegorz Papkala, all rights reserved.
91  
92 This program is free software; you can redistribute it and/or modify it
93 under the same terms as Perl itself.
94  
95 =cut
« TableX/Row.pm ↑ Summary TableX/Stylable.pm »