| 1 | package PDF::TableX::Stylable; | ||||||||||
| 2 | |||||||||||
| 3 | 8 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 8 | ▶ | use PDF::TableX::Types qw/StyleDefinition/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | # public attributes for styles | ||||||||||
| 7 | 0 | ▶ | has padding => (is => 'rw', isa => StyleDefinition, coerce => 1, default => sub{[1,1,1,1]} ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 8 | 0 | ▶ | has border_width => (is => 'rw', isa => StyleDefinition, coerce => 1, default => sub{[1,1,1,1]} ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 9 | 8 | has border_color => (is => 'rw', isa => StyleDefinition, coerce => 1, default => 'black' ); | |||||||||
| 10 | 8 | has border_style => (is => 'rw', isa => StyleDefinition, coerce => 1, default => 'solid' ); | |||||||||
| 11 | 8 | has background_color => (is => 'rw', isa => 'Str', default => '' ); | |||||||||
| 12 | 8 | has text_align => (is => 'rw', isa => 'Str', default => 'left'); | |||||||||
| 13 | 8 | has font => (is => 'rw', isa => 'Any', default => 'Times'); | |||||||||
| 14 | 8 | has font_color => (is => 'rw', isa => 'Str', default => 'black'); | |||||||||
| 15 | 8 | has font_size => (is => 'rw', isa => 'Num', default => 12); | |||||||||
| 16 | 8 | has margin => (is => 'rw', isa => StyleDefinition, coerce => 1, default => (10 / 25.4 *72) ); | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | has _children => (is => 'ro', init_arg => undef, isa => 'ArrayRef[ Object ]', default => sub {[]}); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 19 | |||||||||||
| 20 | 8 | for my $attr ( __PACKAGE__->attributes ) { | |||||||||
| 21 | around $attr => sub { | ||||||||||
| 22 | 0 | ▶ | my ($orig, $self, $value) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 23 | 0 | ▶ | if ( defined $value ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | $self->$orig($value); | |||||||||
| 25 | 0 | for (@{$self->{_children}}) { | |||||||||
| 26 | 0 | $_->$attr( $value ); | |||||||||
| 27 | } | ||||||||||
| 28 | 0 | return $self; | |||||||||
| 29 | } else { | ||||||||||
| 30 | 0 | return $self->$orig; | |||||||||
| 31 | } | ||||||||||
| 32 | 80 | }; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | sub attributes { | ||||||||||
| 36 | 8 | ▶ | return (grep !/^_/, __PACKAGE__->meta->get_attribute_list); | ||||||||
|
Subroutine
attributes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 8 | 1; | |||||||||