2_0/Role/Scroll.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 58 CC 4 SCAR 18.3
CC
4
Cov
0%
scroll_request
12.0
DEMOLISH
6.0
BEGIN
2.0
CRAP 6.2
1 # Licensed to Elasticsearch B.V under one or more agreements.
2 # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 # See the LICENSE file in the project root for more information
4  
5 package Search::Elasticsearch::Client::2_0::Role::Scroll;
6 $Search::Elasticsearch::Client::2_0::Role::Scroll::VERSION = '7.30_1'; # TRIAL
7  
8 $Search::Elasticsearch::Client::2_0::Role::Scroll::VERSION = '7.301';
9 use Moo::Role;
10 requires 'finish';
11 use Search::Elasticsearch::Util qw(parse_params throw);
12 use Devel::GlobalDestruction;
13 use namespace::clean;
14  
15 has 'es' => ( is => 'ro', required => 1 );
16 has 'scroll' => ( is => 'ro' );
17 has 'scroll_in_qs' => ( is => 'ro' );
18 has 'total' => ( is => 'rwp' );
19 has 'max_score' => ( is => 'rwp' );
20 has 'facets' => ( is => 'rwp' );
21 has 'aggregations' => ( is => 'rwp' );
22 has 'suggest' => ( is => 'rwp' );
23 has 'took' => ( is => 'rwp' );
24 has 'total_took' => ( is => 'rwp' );
25 has 'search_params' => ( is => 'ro' );
26 has 'is_finished' => ( is => 'rwp', default => '' );
27 has '_pid' => ( is => 'ro', default => sub {$$} );
28 has '_scroll_id' => ( is => 'rwp', clearer => 1, predicate => 1 );
29  
30 #===================================
31 sub scroll_request {
32 #===================================
33 my $self = shift;
34 throw( 'Illegal',
35 'Scroll requests are not fork safe and may only be '
36 . 'refilled by the same process that created the instance.' )
37 if $self->_pid != $$;
38  
39 my %args = ( scroll => $self->scroll );
40 if ( $self->scroll_in_qs ) {
41 $args{scroll_id} = $self->_scroll_id;
42 }
43 else {
44 $args{body} = $self->_scroll_id;
45 }
46 $self->es->scroll(%args);
47 }
48  
49 #===================================
50 sub DEMOLISH {
51 #===================================
52 my $self = shift or return;
53 return if in_global_destruction;
54 $self->finish;
55 }
56  
57 1;
58  
59 # ABSTRACT: Provides common functionality to L<Search::Elasticsearch::Client::2_0::Scroll> and L<Search::Elasticsearch::Client::2_0::Async::Scroll>
60  
61 __END__