line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Gnip::ActivityStream; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
2189
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
213
|
|
4
|
5
|
|
|
5
|
|
27
|
use base qw(Net::Gnip::BaseStream); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
3624
|
|
5
|
|
|
|
|
|
|
use Net::Gnip::Activity; |
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
|
|
|
|
|
|
|
sub publisher { shift->_do('publisher',@_) } |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 activities [activity[s]] |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Get or set the activities |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub activities { |
68
|
|
|
|
|
|
|
my $self = shift; |
69
|
|
|
|
|
|
|
return $self->children(@_); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _child_name { 'activity' } |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _elem_name { 'activities' } |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |