| 1 | package Net::Gnip::ActivityStream; | ||
| 2 | |||
| 3 | 8 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 8 | ▶ | use base qw(Net::Gnip::BaseStream); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 8 | ▶ | use Net::Gnip::Activity; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Net::Gnip::ActivityStream - represent a stream of Gnip Activities | ||
| 10 | |||
| 11 | =head1 SYNOPIS | ||
| 12 | |||
| 13 | |||
| 14 | # Create a new stream | ||
| 15 | my $stream = Net::Gnip::ActivityStream->new(); | ||
| 16 | my $stream = Net::Gnip::ActivityStream->new(publisher => $publisher_name); | ||
| 17 | |||
| 18 | # ... or parse from XML | ||
| 19 | my $stream = Net::Gnip::ActivityStream->parse($xml); | ||
| 20 | |||
| 21 | # set the activities | ||
| 22 | $stream->activities(@activities); | ||
| 23 | |||
| 24 | # get the activities | ||
| 25 | my @activities = $stream->activities; | ||
| 26 | |||
| 27 | # or use an iterator | ||
| 28 | while (my $activity = $stream->next) { | ||
| 29 | print $activity->uid; | ||
| 30 | } | ||
| 31 | |||
| 32 | $stream->reset; | ||
| 33 | |||
| 34 | # ... now you can use it again | ||
| 35 | while (my $activity = $stream->next) { | ||
| 36 | print $activity->uid; | ||
| 37 | } | ||
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | =head1 METHODS | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | =head2 new | ||
| 47 | |||
| 48 | Create a new, empty stream | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | |||
| 53 | =head2 publisher [publisher name] | ||
| 54 | |||
| 55 | Get or set the publisher name of this Activity Stream | ||
| 56 | |||
| 57 | =cut | ||
| 58 | 0 | ▶ | sub publisher { shift->_do('publisher',@_) } |
|
Subroutine
publisher: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 59 | |||
| 60 | |||
| 61 | =head2 activities [activity[s]] | ||
| 62 | |||
| 63 | Get or set the activities | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | 16 | ▶ | sub activities { |
|
Subroutine
activities: called CC=1 SCAR=0.0
Pod
documented
| |||
| 68 | 16 | my $self = shift; | |
| 69 | 16 | return $self->children(@_); | |
| 70 | } | ||
| 71 | |||
| 72 | 4 | ▶ | sub _child_name { 'activity' } |
|
Subroutine
_child_name: called CC=1 SCAR=0.0
| |||
| 73 | |||
| 74 | 2 | ▶ | sub _elem_name { 'activities' } |
|
Subroutine
_elem_name: called CC=1 SCAR=0.0
| |||
| 75 | |||
| 76 | |||
| 77 | 8 | 1; | |