blib/lib/PDF/Make/Builder/Form/Field/Listbox.pm

filter: Statementstmt 100% 21 / 21 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 93.7% 30 / 32 CC 4 SCAR 6.4
CC
4
Cov
96%
_create_field
3.0
BUILD
2.0
BEGIN
1.0
CRAP 1.9
« blib/lib/PDF/Make/Field.pm ↑ Summary blib/lib/PDF/Make/Builder/Form/Field/Radio.pm »
1 package PDF::Make::Builder::Form::Field::Listbox;
2 53 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 53 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 53 ▶use Object::Proto;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 53 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 53 Object::Proto::define('PDF::Make::Builder::Form::Field::Listbox',
8 extends => 'PDF::Make::Builder::Form::Field',
9 'options:ArrayRef:default([])',
10 );
11 53 Object::Proto::import_accessors('PDF::Make::Builder::Form::Field::Listbox');
12 }
13  
14 2 ▶sub BUILD {
Subroutine BUILD: called CC=2 SCAR=6.9
Pod undocumented
15 2 my ($self) = @_;
16 # Listboxes default taller to show multiple items
17 2 ▶ $self->h(80) unless defined $self->[3]; # h slot
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->[3] 1 1 2
18 }
19  
20 2 ▶sub _create_field {
Subroutine _create_field: called CC=3 SCAR=11.0
21 2 my ($self, $doc, $name, $fx, $fy, $fw, $fh) = @_;
22 2 my $field = PDF::Make::FieldPtr::listbox($doc, $name, $fx, $fy, $fw, $fh);
23 2 my $opts = options $self;
24 2 for my $opt (@$opts) {
25 8 ▶ my ($val, $display) = ref $opt ? @$opt : ($opt, $opt);
Branch: 1 branch
BranchTrueFalseTotal
ref $opt ? : 0 8 8
26 8 $field->add_option($display, $val);
27 }
28 2 return $field;
29 }
30  
31 53 1;
32  
33 __END__
« blib/lib/PDF/Make/Field.pm ↑ Summary blib/lib/PDF/Make/Builder/Form/Field/Radio.pm »