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