Template/Element/MergeRange.pm

filter: Statementstmt 48.2% 14 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 47.5% 19 / 40 CC 3 SCAR 16.3
CC
3
Cov
42%
render
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.1
« Template/Container/Row.pm ↑ Summary Template/Element/Backref.pm »
1 package Excel::Template::Element::MergeRange;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 BEGIN {
6 1 ▶ use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶ @ISA = qw(Excel::Template::Element);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶ use Excel::Template::Element;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶ use Excel::Template::Element::Range;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 }
12  
13 sub render {
14 0 ▶ my $self = shift;
Subroutine render: not called CC=3 SCAR=24.8
Pod undocumented
15 0 my ($context) = @_;
16
17 0 my $ref_name = $context->resolve($self, 'REF');
18  
19 0 my @refs = $context->get_all_references( $ref_name );
20 0 ▶ (@refs)
Branch: 1 branch
BranchTrueFalseTotal
@refs or die "You must specify a ref for MERGE_RANGE" 0 0 0
21 || die "You must specify a ref for MERGE_RANGE";
22
23 0 my $range = Excel::Template::Element::Range->_join_refs(@refs);
24  
25 # NOTE:
26 # we need to copy the current format
27 # because Spreadsheet::WriteExcel will
28 # mark any format used in a merged cell
29 # as being specifically for a merged cell
30 # and therefore not usable elsewhere.
31
32 0 my $old_format = $context->active_format;
33  
34 0 my %values;
35 0 ▶ while ( my ($k, $v) = each %$self ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$self) 0 0 0
36 0 $values{$k} = $context->resolve( $self, $k );
37 }
38  
39 0 my $format = $context->format_object->copy(
40 $context, $old_format, %values,
41 );
42 0 $context->active_format($format);
43  
44 0 $context->active_worksheet->merge_range(
45 $range,
46 $context->get($self, 'TEXT'),
47 $format,
48 );
49
50 0 $context->active_format($old_format);
51  
52 0 return 1;
53 }
54  
55 1 1;
56 __END__
« Template/Container/Row.pm ↑ Summary Template/Element/Backref.pm »