line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mongol::Cursor; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2064
|
use Moose; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
12
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has 'result' => ( |
6
|
|
|
|
|
|
|
is => 'ro', |
7
|
|
|
|
|
|
|
isa => 'MongoDB::QueryResult', |
8
|
|
|
|
|
|
|
required => 1, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'type' => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => 'Str', |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub all { |
18
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
return map { $self->type()->to_object( $_ ) } |
|
0
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$self->result()->all(); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub has_next { |
25
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return $self->_result() |
28
|
|
|
|
|
|
|
->has_next() |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub next { |
32
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $document = $self->result() |
35
|
|
|
|
|
|
|
->next(); |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
return defined( $document ) ? |
38
|
|
|
|
|
|
|
$self->type()->to_object( $document ) : undef; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Mongol::Cursor - Mongol cursor |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 type |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $type = $cursor->type() |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The class type associated for this cursor. All documents retrieved with this cursor |
64
|
|
|
|
|
|
|
will be automatically deserialized using this class definition. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 result |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $result = $cursor->result(); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The original L<MongoDB::QueryResult> on which this cursor wraps. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 METHODS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 all |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my @objects = $cursor->all(); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Returns all the cursor result as an array of objects. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 has_next |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $bool = $cursor->has_next(); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Checks if there are any objects in the cursor. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 next |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $object = $cursor->next(); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Returns the next object in the cursor. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SEE ALSO |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=over 4 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L<MongoDB::Cursor> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L<MongoDB::QueryResult> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |