| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::PMP::CollectionDoc::Items; |
|
2
|
3
|
|
|
3
|
|
18
|
use Moose; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
17
|
|
|
3
|
3
|
|
|
3
|
|
16306
|
use Carp; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
174
|
|
|
4
|
3
|
|
|
3
|
|
16
|
use Data::Dump qw( dump ); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
106
|
|
|
5
|
3
|
|
|
3
|
|
851
|
use Net::PMP::CollectionDoc::Item; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
858
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.006'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'items' => ( is => 'rw', isa => 'ArrayRef', required => 1 ); |
|
10
|
|
|
|
|
|
|
has 'total' => ( is => 'ro', isa => 'Int', required => 1 ); |
|
11
|
|
|
|
|
|
|
has 'navlinks' => ( is => 'ro', isa => 'Object', ); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub as_array { |
|
16
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
17
|
0
|
|
|
|
|
|
return $self->items; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub next { |
|
21
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
22
|
0
|
|
0
|
|
|
|
$self->{_idx} ||= 0; |
|
23
|
0
|
|
|
|
|
|
my $items = $self->items; |
|
24
|
0
|
|
|
|
|
|
my $count = scalar(@$items); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# grab reference for convenience |
|
27
|
0
|
|
|
|
|
|
my $i = \$self->{_idx}; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#warn sprintf( "[%d] %s\n", $$i, $items->[$$i] ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if ( $$i >= $count ) { |
|
32
|
0
|
|
|
|
|
|
return undef; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
0
|
0
|
0
|
|
|
|
if ( defined $items->[$$i] and ref( $items->[$$i] ) eq 'HASH' ) { |
|
35
|
0
|
|
|
|
|
|
return Net::PMP::CollectionDoc::Item->new( $items->[ $$i++ ] ); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#warn "[$count] [$$i] Items object : " . dump( $items->[$$i] ); |
|
39
|
0
|
|
0
|
|
|
|
while ( |
|
|
|
|
0
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$count >= $$i |
|
41
|
|
|
|
|
|
|
and ( !defined $items->[$$i] |
|
42
|
|
|
|
|
|
|
or ref( $items->[$$i] ) ne 'HASH' ) |
|
43
|
|
|
|
|
|
|
) |
|
44
|
|
|
|
|
|
|
{ |
|
45
|
0
|
|
|
|
|
|
warn "[$$i of $count] invalid Items object : " . dump( $items->[$$i] ); |
|
46
|
0
|
0
|
|
|
|
|
if ( $$i++ >= $count ) { |
|
47
|
0
|
|
|
|
|
|
return undef; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
} |
|
50
|
0
|
|
|
|
|
|
return Net::PMP::CollectionDoc::Item->new( $items->[ $$i++ ] ); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub count { |
|
54
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
55
|
0
|
|
|
|
|
|
return $self->{_idx}; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub reset { |
|
59
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
60
|
0
|
|
|
|
|
|
$self->{_idx} = 0; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Net::PMP::CollectionDoc::Items - items from a Net::PMP::CollectionDoc |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $results = $pmp_client->search({ tag => 'foo' }); |
|
74
|
|
|
|
|
|
|
my $items = $results->get_items(); |
|
75
|
|
|
|
|
|
|
# $items isa Net::PMP::CollectionDoc::Items |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 METHODS |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 as_array |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Returns object as an array. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 next |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Standard iterator method. Returns the next L<Net::PMP::CollectionDoc::Item> from the stack. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 count |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns integer indidating the number of Items returned so far via next(). |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 reset |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Re-initialize the iterator. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Peter Karman, C<< <karman at cpan.org> >> |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 BUGS |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-net-pmp at rt.cpan.org>, or through |
|
102
|
|
|
|
|
|
|
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-PMP>. I will be notified, and then you'll |
|
103
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 SUPPORT |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
perldoc Net::PMP::CollectionDoc::Items |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
You can also look for information at: |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over 4 |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-PMP> |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
L<http://annocpan.org/dist/Net-PMP> |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/Net-PMP> |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item * Search CPAN |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/Net-PMP/> |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=back |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
American Public Media and the Public Media Platform sponsored the development of this module. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Copyright 2013 American Public Media Group |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
See the LICENSE file that accompanies this module. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |