line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Google::RestApi::SheetsApi4::RangeGroup::Tie::Iterator; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '1.0.4'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
602
|
use Google::RestApi::Setup; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
14014
|
use parent qw(Google::RestApi::SheetsApi4::RangeGroup::Iterator); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
1
|
|
|
1
|
1
|
4
|
my $class = shift; |
11
|
1
|
|
|
|
|
5
|
state $check = compile_named( |
12
|
|
|
|
|
|
|
tied => HashRef, |
13
|
|
|
|
|
|
|
_extra_ => slurpy Any, |
14
|
|
|
|
|
|
|
); |
15
|
1
|
|
|
|
|
4386
|
my $p = named_extra($check->(@_)); |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
5
|
my $ptied = delete $p->{tied}; |
18
|
1
|
|
|
|
|
5
|
my $tied = tied(%$ptied); |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
4
|
my $ranges = $tied->ranges(); |
21
|
1
|
|
|
|
|
5
|
my @keys = keys %$ranges; |
22
|
1
|
|
|
|
|
4
|
my @values = values %$ranges; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
4
|
my $range_group = $tied->spreadsheet()->range_group(@values); |
25
|
1
|
|
|
|
|
55
|
my $self = $class->SUPER::new( |
26
|
|
|
|
|
|
|
%$p, |
27
|
|
|
|
|
|
|
range_group => $range_group, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
16
|
$self->{keys} = \@keys; |
31
|
1
|
|
|
|
|
3
|
$self->{tied} = $ptied; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
12
|
return bless $self, $class; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub iterate { |
37
|
2
|
|
|
2
|
1
|
9
|
my $self = shift; |
38
|
2
|
50
|
|
|
|
22
|
my $range_group = $self->SUPER::iterate(@_) or return; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
96
|
my @ranges = $range_group->ranges(); |
41
|
|
|
|
|
|
|
my %ranges = map { |
42
|
2
|
|
|
|
|
8
|
$self->{keys}->[$_] => $ranges[$_]; |
|
6
|
|
|
|
|
30
|
|
43
|
|
|
|
|
|
|
} (0..$#ranges); |
44
|
2
|
|
|
|
|
5
|
my $tied = tied( %{ $self->{tied} }); |
|
2
|
|
|
|
|
8
|
|
45
|
2
|
|
|
|
|
14
|
return $tied->default_worksheet()->tie(%ranges); |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
0
|
1
|
|
sub next { iterate(@_); } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Google::RestApi::SheetsApi4::RangeGroup::Tie::Iterator - An iterator for tied Ranges. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
A RangeGroup::Tie::Iterator is used to iterate through a tied range group, |
60
|
|
|
|
|
|
|
returning a tied range group of cells, one group at a time. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
See the description and synopsis at Google::RestApi::SheetsApi4. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SUBROUTINES |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=over |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item new(tied => <hashref>, %args); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Creates a new Iterator object for the given tied range group. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
tied: A hashref tied to the RangeGroup::Tie object. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
'args' are passed through to the parent RangeGroup::Iterator::new |
75
|
|
|
|
|
|
|
object's routine. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
You would not normally call this directly, you'd use the RangeGroup::Tie::iterator |
78
|
|
|
|
|
|
|
method to create the iterator object for you. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item iterate(); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Return the next group of tied cells in the iteration sequence. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHORS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Robin Murray mvsjes@cpan.org |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=back |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Copyright (c) 2021, Robin Murray. All rights reserved. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. |