| 1 | package Net::OpenSocial::Client::Collection; | ||
| 2 | |||
| 3 | 1 | ▶ | use Any::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Any::Moose 'X::AttributeHelpers'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | has 'start_index' => ( | |
| 7 | is => 'rw', | ||
| 8 | isa => 'Int', | ||
| 9 | default => 0, | ||
| 10 | ); | ||
| 11 | |||
| 12 | 1 | has 'items_per_page' => ( | |
| 13 | is => 'rw', | ||
| 14 | isa => 'Int', | ||
| 15 | ); | ||
| 16 | |||
| 17 | 1 | has 'total_results' => ( | |
| 18 | is => 'rw', | ||
| 19 | isa => 'Int', | ||
| 20 | default => 0, | ||
| 21 | ); | ||
| 22 | |||
| 23 | has 'items' => ( | ||
| 24 | is => 'ro', | ||
| 25 | isa => 'ArrayRef[Net::OpenSocial::Client::Resource]', | ||
| 26 | 0 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 27 | 1 | metaclass => 'Collection::Array', | |
| 28 | provides => { | ||
| 29 | count => 'count', | ||
| 30 | first => 'first', | ||
| 31 | 'push' => 'add_item', | ||
| 32 | }, | ||
| 33 | ); | ||
| 34 | |||
| 35 | 1 | ▶ | no Any::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | 1 | __PACKAGE__->meta->make_immutable; | |
| 37 | 1 | 1; | |
| 38 | |||
| 39 | =head1 NAME | ||
| 40 | |||
| 41 | Net::OpenSocial::Client::Collection - Collection of resources | ||
| 42 | |||
| 43 | =head1 SYNOPSIS | ||
| 44 | |||
| 45 | my $collection = Net::OpenSocial::Client::Collection->new; | ||
| 46 | $collection->items_per_page(10); | ||
| 47 | $collection->total_results(35); | ||
| 48 | $collection->start_index(0); | ||
| 49 | |||
| 50 | $collection->add_item( $resource1 ); | ||
| 51 | $collection->add_item( $resource2 ); | ||
| 52 | ... | ||
| 53 | |||
| 54 | for my $item ( @{ $collection->items } ) { | ||
| 55 | |||
| 56 | } | ||
| 57 | |||
| 58 | =head1 DESCRIPTION | ||
| 59 | |||
| 60 | Collection of resources. | ||
| 61 | |||
| 62 | =head1 METHODS | ||
| 63 | |||
| 64 | =head2 items_per_page | ||
| 65 | |||
| 66 | =head2 total_results | ||
| 67 | |||
| 68 | =head2 start_index | ||
| 69 | |||
| 70 | =head2 items | ||
| 71 | |||
| 72 | =head2 add_item | ||
| 73 | |||
| 74 | =head2 count | ||
| 75 | |||
| 76 | =head2 first | ||
| 77 | |||
| 78 | =head1 SEE ALSO | ||
| 79 | |||
| 80 | L<Net::OpenSocial::Client::Resource> | ||
| 81 | |||
| 82 | =head1 AUTHOR | ||
| 83 | |||
| 84 | Lyo Kato, E<lt>lyo.kato@gmail.comE<gt> | ||
| 85 | |||
| 86 | =head1 COPYRIGHT AND LICENSE | ||
| 87 | |||
| 88 | Copyright (C) 2009 by Lyo Kato | ||
| 89 | |||
| 90 | This library is free software; you can redistribute it and/or modify | ||
| 91 | it under the same terms as Perl itself, either Perl version 5.8.8 or, | ||
| 92 | at your option, any later version of Perl 5 you may have available. | ||
| 93 | |||
| 94 | =cut | ||