TableX/Column.pm

filter: Statementstmt 43.4% 20 / 46 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 3 totaltotal 38.4% 25 / 65 SCAR 29.1
CC
7
Cov
38%
__ANON__
12.0
get_min_width
12.0
get_reg_width
12.0
CRAP 18.4
« 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.2
Subroutine __ANON__: not called CC=1 SCAR=0.2
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 0 ▶ my ($self, $cell) = @_;
Subroutine add_cell: not called CC=1 SCAR=6.9
Pod undocumented
27 0 push @{$self->{_children}}, $cell;
28 }
29  
30 sub get_min_width {
31 0 ▶ my ($self) = @_;
Subroutine get_min_width: not called CC=3 SCAR=24.8
Pod undocumented
32 0 my $width = 0;
33 0 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 undocumented
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 FUNCTIONS
61  
62 =head1 AUTHOR
63  
64 Grzegorz Papkala, C<< <grzegorzpapkala at gmail.com> >>
65  
66 =head1 BUGS
67  
68 Please report any bugs or feature requests at: L<https://github.com/grzegorzpapkala/PDF-TableX/issues>
69  
70 =head1 SUPPORT
71  
72 PDF::TableX is hosted on GitHub L<https://github.com/grzegorzpapkala/PDF-TableX>
73  
74 =head1 ACKNOWLEDGEMENTS
75  
76 =head1 COPYRIGHT & LICENSE
77  
78 Copyright 2013 Grzegorz Papkala, all rights reserved.
79  
80 This program is free software; you can redistribute it and/or modify it
81 under the same terms as Perl itself.
82  
83 =cut
« TableX/Row.pm ↑ Summary TableX/Stylable.pm »