| 1 | package Google::RestApi::SheetsApi4::Range::Row; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | our $VERSION = '2.2.5'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Google::RestApi::Setup; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Try::Tiny qw( try catch ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::Range'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::Range::Cell'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use parent Range; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 43 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | 43 | my $class = shift; | |||||||||||||||||||||||||||
| 16 | 43 | my %self = @_; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 43 | $self{dim} = 'row'; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # this is fucked up, but want to support creating this object directly and also | ||||||||||||||||||||||||||||
| 21 | # via the range::factory method, so have to handle both cases here. try to create | ||||||||||||||||||||||||||||
| 22 | # the row directly first (which could also come via the factory method, which will | ||||||||||||||||||||||||||||
| 23 | # have already translated the address into a row), and failing that, see if the | ||||||||||||||||||||||||||||
| 24 | # range factory can create a row (which will resolve any named or header references). | ||||||||||||||||||||||||||||
| 25 | # this has the potential of looping between this and factory method. | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | # if factory has already been used, then this should resolve here. | ||||||||||||||||||||||||||||
| 28 | 43 | my $err; | |||||||||||||||||||||||||||
| 29 | 43 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 30 | 43 | state $check = signature(positional => [RangeRow]); | |||||||||||||||||||||||||||
| 31 | 43 | ($self{range}) = $check->($self{range}); | |||||||||||||||||||||||||||
| 32 | 6 | ▶ | } catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | 6 | $err = $_; | |||||||||||||||||||||||||||
| 34 | 43 | }; | |||||||||||||||||||||||||||
| 35 | 43 | ▶ | return $class->SUPER::new(%self) if !$err; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | # see if the range passed can be translated to what we want via the factory. | ||||||||||||||||||||||||||||
| 38 | 6 | my $factory_range; | |||||||||||||||||||||||||||
| 39 | 6 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 40 | 6 | $factory_range = Google::RestApi::SheetsApi4::Range::factory(%self); | |||||||||||||||||||||||||||
| 41 | 6 | ▶ | } catch {}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 42 | 6 | ▶ | return $factory_range if $factory_range && $factory_range->isa(__PACKAGE__); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$factory_range and $factory_range->isa(__PACKAGE__)
MC/DC50%1/2
$factory_range and $factory_range->isa(__PACKAGE__)
$factory_range
$factory_range->isa(__PACKAGE__)
Truth table66%2/3
A and B
A= $factory_rangeB= $factory_range->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 2 | LOGDIE sprintf("Unable to translate '%s' into a worksheet row: $err", flatten_range($self{range})); | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 24 | ▶ | sub values { | ||||||||||||||||||||||||||
|
Subroutine
values: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | 24 | my $self = shift; | |||||||||||||||||||||||||||
| 49 | 24 | state $check = signature( | |||||||||||||||||||||||||||
| 50 | bless => !!0, | ||||||||||||||||||||||||||||
| 51 | named => [ | ||||||||||||||||||||||||||||
| 52 | values => ArrayRef[Str], { optional => 1 }, | ||||||||||||||||||||||||||||
| 53 | _extra_ => slurpy HashRef, | ||||||||||||||||||||||||||||
| 54 | ], | ||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||
| 56 | 24 | my $p = named_extra($check->(@_)); | |||||||||||||||||||||||||||
| 57 | 24 | ▶ | $p->{values} = [ $p->{values} ] if defined $p->{values}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 24 | my $values = $self->SUPER::values(%$p); | |||||||||||||||||||||||||||
| 59 | 24 | ▶ | return defined $values ? $values->[0] : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 12 | ▶ | sub batch_values { | ||||||||||||||||||||||||||
|
Subroutine
batch_values: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 12 | my $self = shift; | |||||||||||||||||||||||||||
| 64 | 12 | state $check = signature( | |||||||||||||||||||||||||||
| 65 | bless => !!0, | ||||||||||||||||||||||||||||
| 66 | named => [ | ||||||||||||||||||||||||||||
| 67 | values => ArrayRef[Str], { optional => 1 }, | ||||||||||||||||||||||||||||
| 68 | ], | ||||||||||||||||||||||||||||
| 69 | ); | ||||||||||||||||||||||||||||
| 70 | 12 | my $p = $check->(@_); | |||||||||||||||||||||||||||
| 71 | 12 | ▶ | $p->{values} = [ $p->{values} ] if $p->{values}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 12 | return $self->SUPER::batch_values(%$p); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 6 | ▶ | sub cell_at_offset { | ||||||||||||||||||||||||||
|
Subroutine
cell_at_offset: called CC=4 SCAR=14.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 76 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 6 | state $check = signature(positional => [Int, DimColRow, { optional => 1 }]); | |||||||||||||||||||||||||||
| 79 | 6 | my ($offset) = $check->(@_); # we're a column, no dim required. | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 6 | my $row_range = $self->range_to_array($Google::RestApi::SheetsApi4::Range::RANGE_EXPANDED); # can't use aliased | |||||||||||||||||||||||||||
| 82 | 6 | my $cell_range = $row_range->[0]; | |||||||||||||||||||||||||||
| 83 | 6 | ▶ | $cell_range->[0] = ($cell_range->[0] || 1) + $offset; | ||||||||||||||||||||||||||
|
Condition50%1/2
$$cell_range[0] || 1
MC/DC0%0/1
$$cell_range[0] || 1
$$cell_range[0]
Truth table50%1/2
A
A= $$cell_range[0]
| |||||||||||||||||||||||||||||
| 84 | 6 | ▶ | return if $row_range->[1]->[0] && $cell_range->[0] > $row_range->[1]->[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$$row_range[1][0] and $$cell_range[0] > $$row_range[1][0]
MC/DC0%0/2
$$row_range[1][0] and $$cell_range[0] > $$row_range[1][0]
$$row_range[1][0]
$$cell_range[0] > $$row_range[1][0]
Truth table33%1/3
A and B
A= $$row_range[1][0]B= $$cell_range[0] > $$row_range[1][0]
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 6 | my $cell = Cell->new(worksheet => $self->worksheet(), range => $cell_range); | |||||||||||||||||||||||||||
| 87 | 6 | $cell->share_values($self); | |||||||||||||||||||||||||||
| 88 | 6 | return $cell; | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 15 | ▶ | sub is_other_inside { | ||||||||||||||||||||||||||
|
Subroutine
is_other_inside: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||
| 92 | 15 | my $self = shift; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 15 | state $check = signature(positional => [HasRange]); | |||||||||||||||||||||||||||
| 95 | 15 | my ($inside_range) = $check->(@_); | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 15 | my $range = $self->range_to_hash($Google::RestApi::SheetsApi4::Range::RANGE_EXPANDED); | |||||||||||||||||||||||||||
| 98 | 15 | $inside_range = $inside_range->range_to_hash($Google::RestApi::SheetsApi4::Range::RANGE_EXPANDED); # can't use aliased. | |||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 15 | ▶ | return if $range->[0]->{row} ne $inside_range->[0]->{row}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 12 | ▶ | return if $range->[1]->{row} ne $inside_range->[1]->{row}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 12 | ▶ | return if $range->[0]->{col} && $range->[0]->{col} > $inside_range->[0]->{col}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$$range[0]{"col"} and $$range[0]{"col"} > $$inside_range[0]{"col"}
MC/DC100%2/2
$$range[0]{"col"} and $$range[0]{"col"} > $$inside_range[0]{"col"}
$$range[0]{"col"}
$$range[0]{"col"} > $$inside_range[0]{"col"}
Truth table100%3/3
A and B
A= $$range[0]{"col"}B= $$range[0]{"col"} > $$inside_range[0]{"col"}
| |||||||||||||||||||||||||||||
| 103 | 10 | ▶ | return if $range->[1]->{col} && $range->[1]->{col} < $inside_range->[1]->{col}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$$range[1]{"col"} and $$range[1]{"col"} < $$inside_range[1]{"col"}
MC/DC0%0/2
$$range[1]{"col"} and $$range[1]{"col"} < $$inside_range[1]{"col"}
$$range[1]{"col"}
$$range[1]{"col"} < $$inside_range[1]{"col"}
Truth table66%2/3
A and B
A= $$range[1]{"col"}B= $$range[1]{"col"} < $$inside_range[1]{"col"}
| |||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 10 | return 1; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub freeze { | ||||||||||||||||||||||||||
|
Subroutine
freeze: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 110 | 0 | my $range = $self->range_to_dimension('row'); | |||||||||||||||||||||||||||
| 111 | 0 | return $self->freeze_rows($range->{endIndex}); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub thaw { | ||||||||||||||||||||||||||
|
Subroutine
thaw: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 115 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 116 | 0 | my $range = $self->range_to_dimension('row'); | |||||||||||||||||||||||||||
| 117 | 0 | return $self->freeze_rows($range->{startIndex}); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub heading { shift->SUPER::heading(@_)->freeze(); } | ||||||||||||||||||||||||||
|
Subroutine
heading: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 121 | 0 | ▶ | sub insert_d { shift->insert_dimension(inherit => shift); } | ||||||||||||||||||||||||||
|
Subroutine
insert_d: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub insert_dimension { shift->SUPER::insert_dimension(dimension => 'row', @_); } | ||||||||||||||||||||||||||
|
Subroutine
insert_dimension: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 123 | 0 | ▶ | sub move_dimension { shift->SUPER::move_dimension(dimension => 'row', @_); } | ||||||||||||||||||||||||||
|
Subroutine
move_dimension: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub delete_dimension { shift->SUPER::delete_dimension(dimension => 'row', @_); } | ||||||||||||||||||||||||||
|
Subroutine
delete_dimension: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 2 | 1; | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | __END__ | ||||||||||||||||||||||||||||