« RestApi/Auth/OAuth2Client.pm
↑ Summary
RestApi/SheetsApi4/Request/Spreadsheet/Worksheet/Range.pm »
| 1 | package Google::RestApi::SheetsApi4::Worksheet; | ||||||||||||||||||||||||||||||||||||||||||
| 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 List::MoreUtils qw( first_index ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::Range'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::Range::Col'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::Range::Row'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::Range::Cell'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::Range::All'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::RangeGroup::Tie'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use aliased 'Google::RestApi::SheetsApi4::RangeGroup::Iterator'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use parent 'Google::RestApi::SheetsApi4::Request::Spreadsheet::Worksheet'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 95 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 95 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 95 | my $qr_worksheet_uri = $Google::RestApi::SheetsApi4::Worksheet_Uri; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 95 | state $check = signature( | |||||||||||||||||||||||||||||||||||||||||
| 25 | bless => !!0, | ||||||||||||||||||||||||||||||||||||||||||
| 26 | named => [ | ||||||||||||||||||||||||||||||||||||||||||
| 27 | spreadsheet => HasApi, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | id => Str, { optional => 1 }, # the worksheet id (1, 2, 3 etc). | ||||||||||||||||||||||||||||||||||||||||||
| 29 | name => Str, { optional => 1 }, # the name of the worksheet. | ||||||||||||||||||||||||||||||||||||||||||
| 30 | title => Str, { optional => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 31 | uri => StrMatch[qr|$qr_worksheet_uri|], { optional => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 32 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 95 | my $self = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 35 | 95 | $self = bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 95 | ▶ | $self->{name} ||= $self->{title}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$$self{"name"} ||= $$self{"title"}
MC/DC50%1/2
$$self{"name"} ||= $$self{"title"}
$$self{"name"}
$$self{"title"}
Truth table66%2/3
A ||= B
A= $$self{"name"}B= $$self{"title"}
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 95 | delete $self->{title}; | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | defined $self->{id} || defined $self->{name} || $self->{uri} | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 95 | ▶ | or LOGDIE "At least one of id, name, or uri must be specified"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $$self{"id"} or defined $$self{"name"} or $$self{"uri"}
defined $$self{"id"} or defined $$self{"name"}
MC/DC100%3/3
defined $$self{"id"} or defined $$self{"name"} or $$self{"uri"}
defined $$self{"id"}
defined $$self{"name"}
$$self{"uri"}
Truth table100%4/4
A or B or C
A= defined $$self{"id"}B= defined $$self{"name"}C= $$self{"uri"}
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 94 | return $self->spreadsheet()->_register_worksheet($self); | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | # work out the id from the uri or the name. | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 370 | ▶ | sub worksheet_id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
worksheet_id: called CC=5 SCAR=19.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 370 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 370 | ▶ | if (!defined $self->{id}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | ▶ | if ($self->{uri}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | my $qr_worksheet_uri = $Google::RestApi::SheetsApi4::Worksheet_Uri; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | ($self->{id}) = $self->{uri} =~ m|$qr_worksheet_uri|; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | LOGDIE "Unable to extract a worksheet id from URI '$self->{uri}'" if !defined $self->{id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | my $worksheets = $self->spreadsheet()->worksheet_properties('(title,sheetId)'); # potential recursion if $self->properties() | |||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my ($worksheet) = grep { $_->{title} eq $self->{name}; } @$worksheets; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | $worksheet or LOGDIE "Worksheet '$self->{name}' not found"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | $self->{id} = $worksheet->{sheetId}; | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | DEBUG("Got worksheet id '$self->{id}'"); | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 370 | return $self->{id}; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 1096 | ▶ | sub worksheet_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
worksheet_name: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 1096 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 1096 | ▶ | $self->{name} //= $self->properties('title')->{title}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$$self{"name"} //= $self->properties("title")->{"title"}
MC/DC0%0/2
$$self{"name"} //= $self->properties("title")->{"title"}
$$self{"name"}
$self->properties("title")->{"title"}
Truth table66%2/3
A //= B
A= $$self{"name"}B= $self->properties("title")->{"title"}
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 1096 | return $self->{name}; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub worksheet_title { worksheet_name(@_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
worksheet_title: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | # https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0 | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | ▶ | sub worksheet_uri { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
worksheet_uri: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | ▶ | if (!$self->{uri}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | my $id = $self->worksheet_id(); | |||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | $self->{uri} = "/edit#gid=$id"; | |||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | return $self->spreadsheet()->spreadsheet_uri() . "/$self->{uri}"; | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 93 | ▶ | sub properties { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
properties: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 93 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 93 | my $what = shift; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 93 | my $id = $self->worksheet_id(); | |||||||||||||||||||||||||||||||||||||||||
| 86 | 93 | my $worksheets = $self->spreadsheet()->worksheet_properties("($what,sheetId)"); | |||||||||||||||||||||||||||||||||||||||||
| 87 | 93 | my ($worksheet) = grep { $_->{sheetId} eq $id; } @$worksheets; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 93 | ▶ | $worksheet or LOGDIE "Worksheet '$id' not found"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 93 | return $worksheet; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | # the following don't return ranges and don't use any batch, they are immediate. | ||||||||||||||||||||||||||||||||||||||||||
| 93 | # first arg is a range in any format. allow the range_col call to verify it. | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 3 | ▶ | sub col { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
col: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 3 | state $check = signature(positional => [Defined, ArrayRef[Str], { optional => 1 }]); # A or 1 | |||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | my ($col, $values) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | my $range = $self->range_col($col); | |||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | ▶ | return $range->values(defined $values ? (values => $values) : ()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 3 | ▶ | sub cols { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cols: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 3 | state $check = signature(positional => [ArrayRef[Defined], ArrayRef[ArrayRef[Str]], { optional => 1 }]); | |||||||||||||||||||||||||||||||||||||||||
| 106 | 3 | my ($cols, $values) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 3 | my $range_group = $self->range_group_cols($cols); | |||||||||||||||||||||||||||||||||||||||||
| 109 | 2 | ▶ | return $range_group->values() if !$values; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | my @ranges = $range_group->ranges(); | |||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | foreach my $i (0..$#ranges) { | |||||||||||||||||||||||||||||||||||||||||
| 113 | 3 | $ranges[$i]->batch_values( | |||||||||||||||||||||||||||||||||||||||||
| 114 | values => $values->[$i], | ||||||||||||||||||||||||||||||||||||||||||
| 115 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | return $range_group->submit_values(); | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 7 | ▶ | sub row { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
row: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 7 | state $check = signature(positional => [Defined, ArrayRef[Str], { optional => 1 }]); | |||||||||||||||||||||||||||||||||||||||||
| 124 | 7 | my ($row, $values) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 125 | 7 | my $range = $self->range_row($row); | |||||||||||||||||||||||||||||||||||||||||
| 126 | 6 | ▶ | return $range->values(defined $values ? (values => $values) : ()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 3 | ▶ | sub rows { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rows: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 3 | state $check = signature(positional => [ArrayRef[Defined], ArrayRef[ArrayRef[Str]], { optional => 1 }]); | |||||||||||||||||||||||||||||||||||||||||
| 133 | 3 | my ($rows, $values) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 3 | my $range_group = $self->range_group_rows($rows); | |||||||||||||||||||||||||||||||||||||||||
| 136 | 2 | ▶ | return $range_group->values() if !$values; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | my @ranges = $range_group->ranges(); | |||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | foreach my $i (0..$#ranges) { | |||||||||||||||||||||||||||||||||||||||||
| 140 | 3 | $ranges[$i]->batch_values( | |||||||||||||||||||||||||||||||||||||||||
| 141 | values => $values->[$i], | ||||||||||||||||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | return $range_group->submit_values(); | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 48 | ▶ | sub cell { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cell: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 48 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 48 | state $check = signature(positional => [Defined, Str, { optional => 1 }]); | |||||||||||||||||||||||||||||||||||||||||
| 151 | 48 | my ($cell, $value) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 152 | 48 | my $range = $self->range_cell($cell); | |||||||||||||||||||||||||||||||||||||||||
| 153 | 48 | ▶ | return $range->values(defined $value ? (values => $value) : ()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub cells { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cells: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | state $check = signature(positional => [ArrayRef[Defined], ArrayRef[Str], { optional => 1 }]); | |||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my ($cells, $values) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $range_group = $self->range_group_cells($cells); | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | return $range_group->values() if !$values; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my @ranges = $range_group->ranges(); | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | foreach my $i (0..$#ranges) { | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $ranges[$i]->batch_values( | |||||||||||||||||||||||||||||||||||||||||
| 168 | values => $values->[$i], | ||||||||||||||||||||||||||||||||||||||||||
| 169 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | return $range_group->submit_values(); | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | # the 'ranges' key is poorly named since we can also submit requests for | ||||||||||||||||||||||||||||||||||||||||||
| 176 | # worksheets and spreadsheets. minor since this is all internal anyway. | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 19 | ▶ | sub submit_requests { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit_requests: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 19 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 19 | return $self->spreadsheet()->submit_requests(ranges => [ $self ], @_); | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | # this is used by range to see if there is a match for a header col or row. | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub resolve_header_range { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_header_range: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 185 | return | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | $self->resolve_header_range_col(@_) || | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->resolve_header_range_col(@_) || $self->resolve_header_range_row(@_)
MC/DC0%0/2
$self->resolve_header_range_col(@_) || $self->resolve_header_range_row(@_)
$self->resolve_header_range_col(@_)
$self->resolve_header_range_row(@_)
Truth table0%0/3
A || B
A= $self->resolve_header_range_col(@_)B= $self->resolve_header_range_row(@_)
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | $self->resolve_header_range_row(@_); | ||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | sub resolve_header_range_col { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_header_range_col: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | state $check = signature(positional => [RangeNamed]); | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my ($header) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | my $headers = $self->header_col() or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | my $i = first_index { $_ eq $header; } @$headers; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | return [{col => 2, row => $i}, {row => $i}] if ++$i > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub resolve_header_range_row { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_header_range_row: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | state $check = signature(positional => [RangeNamed]); | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my ($header) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | my $headers = $self->header_row() or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | my $i = first_index { $_ eq $header; } @$headers; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | return [{col => $i, row => 2}, {col => $i}] if ++$i > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | # call this before calling tie_rows or header_col. | ||||||||||||||||||||||||||||||||||||||||||
| 217 | # ('i really want to do this') turns it on, (false) turns it off. | ||||||||||||||||||||||||||||||||||||||||||
| 218 | # you must pass 'i really want to do this' to enable it. this is because you | ||||||||||||||||||||||||||||||||||||||||||
| 219 | # may have a worksheet with thousands of rows that end up being 'headers'. | ||||||||||||||||||||||||||||||||||||||||||
| 220 | # this is less of an issue with header row. | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub enable_header_col { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_header_col: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | my $enable = shift // 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() // 1
MC/DC0%0/1
shift() // 1
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | if ($enable =~ qr/i really want to do this/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $self->{header_col_enabled} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } elsif ($enable) { | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | LOGDIE("You must enable header column by passing 'I really want to do this'"); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | delete @{$self}{qw(header_col header_col_enabled)}; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | return $enable; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | # call with true to refresh. | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | sub header_col { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_col: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $refresh = shift; | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if (!$self->{header_col_enabled}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | DEBUG("Header column is not enabled, call 'enable_header_col' first."); | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | delete $self->{header_col}; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | delete $self->{header_col} if $refresh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | if (!$self->{header_col}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $self->{header_col} = $self->col(1); | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | DEBUG("Header col found:\n", Dump($self->{header_col})); | |||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | return $self->{header_col}; | |||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | # call this before calling tie_cols (to use headings) or header_row. | ||||||||||||||||||||||||||||||||||||||||||
| 256 | # () or (true) turns it on, (false) turns it off. | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 6 | ▶ | sub enable_header_row { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_header_row: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 6 | ▶ | my $enable = shift // 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() // 1
MC/DC100%1/1
shift() // 1
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | 6 | ▶ | if ($enable) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 5 | $self->{header_row_enabled} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | delete @{$self}{qw(header_row header_row_enabled)}; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 6 | return $enable; | |||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | # call with 1 to refresh. | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 4 | ▶ | sub header_row { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_row: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 4 | my $refresh = shift; | |||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | ▶ | if (!$self->{header_row_enabled}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | DEBUG("Header row is not enabled, call 'enable_header_row' first."); | |||||||||||||||||||||||||||||||||||||||||
| 275 | 2 | delete $self->{header_row}; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 2 | ▶ | delete $self->{header_row} if $refresh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | ▶ | if (!$self->{header_row}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 2 | $self->{header_row} = $self->row(1); | |||||||||||||||||||||||||||||||||||||||||
| 283 | 2 | DEBUG("Header row found:\n", Dump($self->{header_row})); | |||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 2 | return $self->{header_row}; | |||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | sub header_col_enabled { shift->{header_col_enabled}; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_col_enabled: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 3 | ▶ | sub header_row_enabled { shift->{header_row_enabled}; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
header_row_enabled: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub normalize_named { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize_named: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | state $check = signature(positional => [RangeNamed]); | |||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | my ($named_range_name) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | my ($sheet_id, $range) = $self->spreadsheet()->normalize_named($named_range_name); | |||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my $this_sheet_id = $self->worksheet_id(); | |||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | LOGDIE "Named range '$named_range_name' sheet ID is '$sheet_id', this sheet ID is '$this_sheet_id'" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$sheet_id and $sheet_id != $this_sheet_id
MC/DC0%0/2
$sheet_id and $sheet_id != $this_sheet_id
$sheet_id
$sheet_id != $this_sheet_id
Truth table0%0/3
A and B
A= $sheet_idB= $sheet_id != $this_sheet_id
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | if $sheet_id && $sheet_id != $this_sheet_id; | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | return $range; | |||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | # create a hash of name => value pairs from two columns in a worksheet. | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | sub name_value_pairs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name_value_pairs: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | state $check = signature( | |||||||||||||||||||||||||||||||||||||||||
| 310 | positional => [ | ||||||||||||||||||||||||||||||||||||||||||
| 311 | Defined, { default => 1 }, # column of names (hash keys). | ||||||||||||||||||||||||||||||||||||||||||
| 312 | Defined, { default => 2 }, # column of values. | ||||||||||||||||||||||||||||||||||||||||||
| 313 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 314 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | my ($name_col, $value_col) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my $cols = $self->cols([$name_col, $value_col]); | |||||||||||||||||||||||||||||||||||||||||
| 318 | my %pairs = map { | ||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | defined $cols->[0]->[$_] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | ? | ||||||||||||||||||||||||||||||||||||||||||
| 321 | ( strip($cols->[0]->[$_]) => strip($cols->[1]->[$_]) ) | ||||||||||||||||||||||||||||||||||||||||||
| 322 | : | ||||||||||||||||||||||||||||||||||||||||||
| 323 | (); | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | } (($self->header_row_enabled() ? 1 : 0)..$#{ $cols->[0] }); | |||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | return \%pairs; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 4 | ▶ | sub tie_cols { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tie_cols: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 4 | ▶ | if (!@_ && $self->header_row_enabled()) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @_ and $self->header_row_enabled
MC/DC50%1/2
not @_ and $self->header_row_enabled
not @_
$self->header_row_enabled
Truth table66%2/3
not(A) and B
A= not @_B= $self->header_row_enabled
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | ▶ | my $headers = $self->header_row() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | or LOGDIE("Header row is enabled but returned no values"); | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 3 | my %ranges = map { $headers->[$_] => [$_ + 1] } | |||||||||||||||||||||||||||||||||||||||||
| 335 | 1 | grep { defined $headers->[$_] } 0..$#$headers; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | return $self->_tie('range_col', %ranges); | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | 3 | return $self->_tie('range_col', @_); | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | ▶ | sub tie_rows { shift->_tie('range_row', @_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tie_rows: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 3 | ▶ | sub tie_cells { shift->_tie('range_cell', @_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tie_cells: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 4 | ▶ | sub tie_ranges { shift->_tie('range_factory', @_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tie_ranges: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 12 | ▶ | sub _tie { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tie: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | state $check = signature( | ||||||||||||||||||||||||||||||||||||||||||
| 348 | positional => [ | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 12 | ▶ | Str->where( sub { /^range/ && $self->can($_) or die "Must be a 'range' method"; } ), | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=13.1
Branch: 1 branch
Condition33%1/3
/^range/ and $self->can($_)
MC/DC0%0/2
/^range/ and $self->can($_)
/^range/
$self->can($_)
Truth table33%1/3
A and B
A= /^range/B= $self->can($_)
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | slurpy HashRef, | ||||||||||||||||||||||||||||||||||||||||||
| 351 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 352 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 12 | my ($method, $ranges) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 12 | my %ranges = map { $_ => $self->$method( $ranges->{$_} ); } keys %$ranges; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 12 | return $self->tie(%ranges); | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 16 | ▶ | sub tie { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tie: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 16 | my $tie = $self->spreadsheet()->tie(@_); | |||||||||||||||||||||||||||||||||||||||||
| 362 | 16 | tied(%$tie)->default_worksheet($self); | |||||||||||||||||||||||||||||||||||||||||
| 363 | 16 | return $tie; | |||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 3 | ▶ | sub range_group_cols { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_group_cols: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 368 | 3 | state $check = signature(positional => [ArrayRef[Defined]]); | |||||||||||||||||||||||||||||||||||||||||
| 369 | 3 | my ($cols) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 370 | 3 | my @cols = map { $self->range_col($_); } @$cols; | |||||||||||||||||||||||||||||||||||||||||
| 371 | 2 | return $self->spreadsheet()->range_group(@cols); | |||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 3 | ▶ | sub range_group_rows { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_group_rows: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 3 | state $check = signature(positional => [ArrayRef[Defined]]); | |||||||||||||||||||||||||||||||||||||||||
| 377 | 3 | my ($rows) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 378 | 3 | my @rows = map { $self->range_row($_); } @$rows; | |||||||||||||||||||||||||||||||||||||||||
| 379 | 2 | return $self->spreadsheet()->range_group(@rows); | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | sub range_group_cells { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_group_cells: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | state $check = signature(positional => [ArrayRef[Defined]]); | |||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | my ($cells) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my @cells = map { $self->range_cell($_); } @$cells; | |||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | return $self->spreadsheet()->range_group(@cells); | |||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | # an arbitrary mix of ranges. | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | sub range_group { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_group: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | state $check = signature(positional => [ArrayRef[Defined]]); | |||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my ($ranges) = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my @ranges = map { $self->range_factory($_); } @$ranges; | |||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | return $self->spreadsheet()->range_group(@ranges); | |||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | # can't use aliased here for some reason. | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 103 | ▶ | sub range_factory { Google::RestApi::SheetsApi4::Range::factory(worksheet => shift, range => shift, @_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_factory: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | 88 | ▶ | sub range { shift->range_factory(@_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | # create these spcific subclasses so that invalid ranges will get caught. | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 39 | ▶ | sub range_col { Col->new(worksheet => shift, range => shift); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_col: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 31 | ▶ | sub range_row { Row->new(worksheet => shift, range => shift); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_row: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | 74 | ▶ | sub range_cell { Cell->new(worksheet => shift, range => shift); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_cell: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | sub range_all { All->new(worksheet => shift, @_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_all: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 59 | ▶ | sub api { shift->spreadsheet()->api(@_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
api: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | sub sheets_api { shift->spreadsheet()->sheets_api(@_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sheets_api: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 7 | ▶ | sub rest_api { shift->spreadsheet()->rest_api(@_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rest_api: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 351 | ▶ | sub spreadsheet { shift->{spreadsheet}; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
spreadsheet: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | sub spreadsheet_id { shift->spreadsheet()->spreadsheet_id(); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
spreadsheet_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | sub transaction { shift->spreadsheet()->transaction(); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transaction: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | __END__ | ||||||||||||||||||||||||||||||||||||||||||