line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Post.pm,v 1.25 2008/03/03 16:55:04 asc Exp $ |
2
|
1
|
|
|
1
|
|
1639
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Net::Delicious::Post; |
5
|
1
|
|
|
1
|
|
5
|
use base qw (Net::Delicious::Object); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
97
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$Net::Delicious::Post::VERSION = '1.14'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Net::Delicious::Post - OOP for del.icio.us post thingies |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Net::Delicious; |
16
|
|
|
|
|
|
|
my $del = Net::Delicious->new({...}); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
foreach my $post ($del->recent_posts()) { |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# $post is a Net::Delicious::Post |
21
|
|
|
|
|
|
|
# object. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
print "$post\n"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
OOP for del.icio.us post thingies. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NOTES |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over 4 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item * |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This package overrides the perl builtin I operator and returns the value of the object's I method. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item * |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
It isn't really expected that you will instantiate these |
41
|
|
|
|
|
|
|
objects outside of I itself. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=back |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
580
|
use Net::Delicious::User; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
48
|
1
|
|
|
1
|
|
5
|
use overload q("") => sub { shift->href() }; |
|
1
|
|
|
0
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
|
0
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 PACKAGE METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 __PACKAGE__->new(\%args) |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Returns a I object. Woot! |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub new { |
61
|
0
|
|
|
0
|
1
|
|
my $pkg = shift; |
62
|
0
|
|
|
|
|
|
my $args = shift; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $self = $pkg->SUPER::new($args); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# this one seems to be the source of some |
67
|
|
|
|
|
|
|
# confusion - unclear whether it's me or |
68
|
|
|
|
|
|
|
# inconsistency in the API itself |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
0
|
|
|
|
$self->{tags} ||= $args->{ tag }; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->{user} = Net::Delicious::User->new({name => $args->{user}}); |
73
|
0
|
|
|
|
|
|
return $self; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 $obj->description() |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns a string. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Defined in Net::Delicious::Object |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 $obj->extended() |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Returns a string. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# Defined in Net::Delicious::Object |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 $obj->href() |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Returns a string. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Defined in Net::Delicious::Object |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub url { |
105
|
0
|
|
|
0
|
0
|
|
return shift->href(); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub link { |
109
|
0
|
|
|
0
|
0
|
|
return shift->href(); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 $obj->tag() |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Returns a string. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# Defined in Net::Delicious::Object |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 $obj->tags() |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns a string. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub tags { |
127
|
0
|
|
|
0
|
1
|
|
return shift->tag(); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 $obj->user() |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Returns a Net::Delicious::User object. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub user { |
137
|
0
|
|
|
0
|
1
|
|
return shift->{user}; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 $obj->time() |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Returns a string, formatted I |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# Defined in Net::Delicious::Object |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 $obj->shared($raw) |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Returns a boolean, unless $raw is true in which case the method will return |
151
|
|
|
|
|
|
|
"no" or "" |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub shared { |
156
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
157
|
0
|
|
|
|
|
|
my $raw = shift; |
158
|
|
|
|
|
|
|
|
159
|
0
|
0
|
|
|
|
|
if ($raw) { |
160
|
0
|
|
|
|
|
|
return $self->{shared}; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
0
|
0
|
|
|
|
|
return ($self->{shared} eq "no") ? 0 : 1; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head2 $obj->as_hashref() |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Return the object as a hash ref safe for serializing and re-blessing. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub as_hashref { |
173
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
174
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
my $data = $self->SUPER::as_hashref(); |
176
|
0
|
|
|
|
|
|
$data->{user} = $self->user()->name(); |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
return $data; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 VERSION |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
1.13 |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 DATE |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
$Date: 2008/03/03 16:55:04 $ |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 AUTHOR |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Aaron Straup Cope |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 SEE ALSO |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
L |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 LICENSE |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Copyright (c) 2004-2008 Aaron Straup Cope. All rights reserved. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
This is free software, you may use it and distribute it under the |
202
|
|
|
|
|
|
|
same terms as Perl itself. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=cut |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
return 1; |