line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Netscape::Bookmarks::Link; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Netscape::Bookmarks::Link - manipulate, or create Netscape Bookmarks links |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Netscape::Bookmarks::Link; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $category = new Netscape::Bookmarks::Category { ... }; |
14
|
|
|
|
|
|
|
my $link = new Netscape::Bookmarks::Link { |
15
|
|
|
|
|
|
|
TITLE => 'this is the title', |
16
|
|
|
|
|
|
|
DESCRIPTION => 'this is the description', |
17
|
|
|
|
|
|
|
HREF => 'http://www.perl.org', |
18
|
|
|
|
|
|
|
ADD_DATE => 937862073, |
19
|
|
|
|
|
|
|
LAST_VISIT => 937862073, |
20
|
|
|
|
|
|
|
LAST_MODIFIED => 937862073, |
21
|
|
|
|
|
|
|
ALIAS_ID => 4, |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$category->add($link); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#print a Netscape compatible file |
28
|
|
|
|
|
|
|
print $link->as_string; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
THIS IS AN ABANDONED MODULE. THERE IS NO SUPPORT. YOU CAN ADOPT IT |
33
|
|
|
|
|
|
|
IF YOU LIKE: https://pause.perl.org/pause/query?ACTION=pause_04about#takeover |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
The Netscape bookmarks file has several basic components: |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
title |
38
|
|
|
|
|
|
|
folders (henceforth called categories) |
39
|
|
|
|
|
|
|
links |
40
|
|
|
|
|
|
|
aliases |
41
|
|
|
|
|
|
|
separators |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
On disk, Netscape browsers store this information in HTML. In the browser, |
44
|
|
|
|
|
|
|
it is displayed under the "Bookmarks" menu. The data can be manipulated |
45
|
|
|
|
|
|
|
through the browser interface. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This module allows one to manipulate the links in for a Netscape bookmarks |
48
|
|
|
|
|
|
|
file. A link has these attributes, only some of which may be present: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
title |
51
|
|
|
|
|
|
|
description |
52
|
|
|
|
|
|
|
HREF (i.e. URL) |
53
|
|
|
|
|
|
|
ADD_DATE |
54
|
|
|
|
|
|
|
LAST_MODIFIED |
55
|
|
|
|
|
|
|
LAST_VISIT |
56
|
|
|
|
|
|
|
ALIAS_OF |
57
|
|
|
|
|
|
|
ALIAS_ID |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Additionally, Mozilla (the open source version of Navigator) uses these |
60
|
|
|
|
|
|
|
attributes: |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
SHORTCUTURL |
63
|
|
|
|
|
|
|
ICON |
64
|
|
|
|
|
|
|
SCHEDULE |
65
|
|
|
|
|
|
|
LAST_PING |
66
|
|
|
|
|
|
|
LAST_CHARSET |
67
|
|
|
|
|
|
|
PING_CONTENT_LEN |
68
|
|
|
|
|
|
|
PING_STATUS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=over 4 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
6
|
|
|
6
|
|
55525
|
use strict; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
181
|
|
77
|
|
|
|
|
|
|
|
78
|
6
|
|
|
6
|
|
28
|
use base qw( Netscape::Bookmarks::AcceptVisitor Netscape::Bookmarks::Isa ); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
982
|
|
79
|
6
|
|
|
6
|
|
30
|
use subs qw(); |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
98
|
|
80
|
6
|
|
|
6
|
|
27
|
use vars qw( $DEBUG $VERSION $ERROR ); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
333
|
|
81
|
|
|
|
|
|
|
|
82
|
6
|
|
|
6
|
|
2778
|
use URI; |
|
6
|
|
|
|
|
31524
|
|
|
6
|
|
|
|
|
6745
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$VERSION = "2.304"; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item Netscape::Bookmarks::Link-Enew( \%hash ) |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Creates a new Link object. The hash reference argument |
89
|
|
|
|
|
|
|
can have the following keys to set the properties of the |
90
|
|
|
|
|
|
|
link: |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
HREF |
93
|
|
|
|
|
|
|
ADD_DATE |
94
|
|
|
|
|
|
|
LAST_MODIFIED |
95
|
|
|
|
|
|
|
LAST_VISIT |
96
|
|
|
|
|
|
|
ALIASID |
97
|
|
|
|
|
|
|
ALIASOF |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
SHORTCUTURL |
100
|
|
|
|
|
|
|
ICON |
101
|
|
|
|
|
|
|
LAST_CHARSET |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub new { |
106
|
456
|
|
|
456
|
1
|
729
|
my $class = shift; |
107
|
456
|
|
|
|
|
549
|
my $param = shift; |
108
|
|
|
|
|
|
|
|
109
|
456
|
|
|
|
|
710
|
my $self = {}; |
110
|
456
|
|
|
|
|
698
|
bless $self, $class; |
111
|
|
|
|
|
|
|
|
112
|
456
|
|
|
|
|
1030
|
my $url = URI->new( $param->{HREF} ); |
113
|
456
|
50
|
|
|
|
59346
|
unless( ref $url ) { |
114
|
0
|
|
|
|
|
0
|
$ERROR = "[$$param{HREF}] is not a valid URL"; |
115
|
0
|
|
|
|
|
0
|
return -1; |
116
|
|
|
|
|
|
|
} |
117
|
456
|
|
|
|
|
898
|
$self->{HREF} = $url; |
118
|
|
|
|
|
|
|
|
119
|
456
|
|
|
|
|
763
|
foreach my $k ( qw(SHORTCUTURL ICON LAST_CHARSET SCHEDULE PING_STATUS) ) { |
120
|
2280
|
|
|
|
|
3662
|
$self->{$k} = $param->{$k}; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
456
|
|
|
|
|
716
|
foreach my $k ( qw(ADD_DATE LAST_MODIFIED LAST_VISIT ALIASID ALIASOF |
124
|
|
|
|
|
|
|
LAST_PING PING_CONTENT_LEN) ) { |
125
|
3192
|
50
|
66
|
|
|
6596
|
if( defined $param->{$k} and $param->{$k} =~ /\D/ ) { |
126
|
0
|
|
|
|
|
0
|
$ERROR = "[$$param{$k}] is not a valid $k"; |
127
|
0
|
|
|
|
|
0
|
return -2; |
128
|
|
|
|
|
|
|
} |
129
|
3192
|
|
|
|
|
5468
|
$self->{$k} = $param->{$k}; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
456
|
50
|
|
|
|
815
|
unless( $param->{'TITLE'} ) { |
133
|
0
|
|
|
|
|
0
|
$ERROR = "The TITLE cannot be null."; |
134
|
0
|
|
|
|
|
0
|
return -3; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
456
|
|
|
|
|
722
|
$self->{'TITLE'} = $param->{'TITLE'}; |
138
|
|
|
|
|
|
|
|
139
|
456
|
|
|
|
|
719
|
$self->{'DESCRIPTION'} = $param->{'DESCRIPTION'}; |
140
|
|
|
|
|
|
|
|
141
|
456
|
|
|
|
|
1059
|
$self; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item $obj->href |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Returns the URL of the link. The URL appears in the HREF attribute of |
148
|
|
|
|
|
|
|
the anchor tag. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub href { |
153
|
238
|
|
|
238
|
1
|
302
|
my $self = shift; |
154
|
|
|
|
|
|
|
|
155
|
238
|
|
|
|
|
575
|
$self->{'HREF'}->as_string |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item $obj->add_date |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Returns the date when the link was added, in Unix epoch time. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub add_date { |
165
|
229
|
|
|
229
|
1
|
286
|
my $self = shift; |
166
|
|
|
|
|
|
|
|
167
|
229
|
|
|
|
|
390
|
$self->{'ADD_DATE'} |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item $obj->last_modified |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Returns the date when the link was last modified, in Unix epoch time. Returns |
173
|
|
|
|
|
|
|
zero if no information is available. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub last_modified { |
178
|
229
|
|
|
229
|
1
|
313
|
my $self = shift; |
179
|
|
|
|
|
|
|
|
180
|
229
|
|
|
|
|
298
|
$self->{'LAST_MODIFIED'} |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item $obj->last_visit |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Returns the date when the link was last vistied, in Unix epoch time. Returns |
186
|
|
|
|
|
|
|
zero if no information is available. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub last_visit { |
191
|
229
|
|
|
229
|
1
|
287
|
my $self = shift; |
192
|
|
|
|
|
|
|
|
193
|
229
|
|
|
|
|
334
|
$self->{'LAST_VISIT'} |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item $obj->title( [ TITLE ] ) |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Sets the link title with the given argument, and returns the link title. |
199
|
|
|
|
|
|
|
If the argument is not defined (e.g. not specified), returns the current |
200
|
|
|
|
|
|
|
link title. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=cut |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub title { |
205
|
229
|
|
|
229
|
1
|
331
|
my( $self, $title ) = @_; |
206
|
|
|
|
|
|
|
|
207
|
229
|
50
|
|
|
|
360
|
$self->{'TITLE'} = $title if defined $title; |
208
|
|
|
|
|
|
|
|
209
|
229
|
|
|
|
|
402
|
$self->{'TITLE'} |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item $obj->description( [ DESCRIPTION ] ) |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Sets the link description with the given argument, and returns the link |
215
|
|
|
|
|
|
|
description. If the argument is not defined (e.g. not specified), |
216
|
|
|
|
|
|
|
returns the current link description. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=cut |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
sub description { |
221
|
232
|
|
|
232
|
1
|
329
|
my( $self, $description ) = @_; |
222
|
|
|
|
|
|
|
|
223
|
232
|
100
|
|
|
|
349
|
$self->{'DESCRIPTION'} = $description if defined $description; |
224
|
|
|
|
|
|
|
|
225
|
232
|
|
|
|
|
412
|
$self->{'DESCRIPTION'} |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item $obj->alias_id |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Returns the alias id of a link. Links with aliases are assigned an ALIAS_ID which |
231
|
|
|
|
|
|
|
associates them with the alias. The alias contains the same value in it's ALIAS_OF |
232
|
|
|
|
|
|
|
field. The Netscape::Bookmarks::Alias module handles aliases as references to |
233
|
|
|
|
|
|
|
Netscape::Bookmarks::Link objects. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=cut |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub aliasid { |
238
|
231
|
|
|
231
|
0
|
279
|
my $self = shift; |
239
|
231
|
|
|
|
|
257
|
my $data = shift; |
240
|
|
|
|
|
|
|
|
241
|
231
|
100
|
|
|
|
344
|
$self->{'ALIASID'} = $data if defined $data; |
242
|
|
|
|
|
|
|
|
243
|
231
|
|
|
|
|
378
|
$self->{'ALIASID'} |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=item $obj->shortcuturl |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=cut |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub shortcuturl { |
251
|
229
|
|
|
229
|
1
|
294
|
my( $self, $shortcuturl ) = @_; |
252
|
|
|
|
|
|
|
|
253
|
229
|
50
|
|
|
|
350
|
$self->{'SHORTCUTURL'} = $shortcuturl if defined $shortcuturl; |
254
|
|
|
|
|
|
|
|
255
|
229
|
|
|
|
|
307
|
$self->{'SHORTCUTURL'} |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=item $obj->icon |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=cut |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
sub icon { |
263
|
229
|
|
|
229
|
1
|
319
|
my( $self, $icon ) = @_; |
264
|
|
|
|
|
|
|
|
265
|
229
|
50
|
|
|
|
316
|
$self->{'ICON'} = $icon if defined $icon; |
266
|
|
|
|
|
|
|
|
267
|
229
|
|
|
|
|
303
|
$self->{'ICON'} |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=item $obj->schedule |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=cut |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub schedule { |
275
|
229
|
|
|
229
|
1
|
296
|
my( $self, $schedule ) = @_; |
276
|
|
|
|
|
|
|
|
277
|
229
|
50
|
|
|
|
333
|
$self->{'SCHEDULE'} = $schedule if defined $schedule; |
278
|
|
|
|
|
|
|
|
279
|
229
|
|
|
|
|
307
|
$self->{'SCHEDULE'} |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=item $obj->last_ping |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=cut |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub last_ping { |
287
|
229
|
|
|
229
|
1
|
339
|
my( $self, $last_ping ) = @_; |
288
|
|
|
|
|
|
|
|
289
|
229
|
50
|
|
|
|
317
|
$self->{'LAST_PING'} = $last_ping if defined $last_ping; |
290
|
|
|
|
|
|
|
|
291
|
229
|
|
|
|
|
298
|
$self->{'LAST_PING'} |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=item $obj->ping_content_len |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=cut |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
sub ping_content_len { |
299
|
229
|
|
|
229
|
1
|
307
|
my( $self, $ping_content_len ) = @_; |
300
|
|
|
|
|
|
|
|
301
|
229
|
50
|
|
|
|
331
|
$self->{'PING_CONTENT_LEN'} = $ping_content_len if defined $ping_content_len; |
302
|
|
|
|
|
|
|
|
303
|
229
|
|
|
|
|
301
|
$self->{'PING_CONTENT_LEN'} |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=item $obj->ping_status |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=cut |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
sub ping_status |
311
|
|
|
|
|
|
|
{ |
312
|
229
|
|
|
229
|
1
|
303
|
my( $self, $ping_status ) = @_; |
313
|
|
|
|
|
|
|
|
314
|
229
|
50
|
|
|
|
354
|
$self->{'PING_STATUS'} = $ping_status if defined $ping_status; |
315
|
|
|
|
|
|
|
|
316
|
229
|
|
|
|
|
300
|
$self->{'PING_STATUS'} |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=item $obj->last_charset |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=cut |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
sub last_charset { |
324
|
229
|
|
|
229
|
1
|
327
|
my( $self, $charset ) = @_; |
325
|
|
|
|
|
|
|
|
326
|
229
|
50
|
|
|
|
344
|
$self->{'LAST_CHARSET'} = $charset if defined $charset; |
327
|
|
|
|
|
|
|
|
328
|
229
|
|
|
|
|
556
|
$self->{'LAST_CHARSET'} |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
# =item $obj->alias_of |
332
|
|
|
|
|
|
|
# |
333
|
|
|
|
|
|
|
# Returns the target id of a link. Links with aliases are assigned an ALIAS_ID which |
334
|
|
|
|
|
|
|
# associates them with the alias. The alias contains the same value in it's ALIAS_OF |
335
|
|
|
|
|
|
|
# field. The Netscape::Bookmarks::Alias module handles aliases as references to |
336
|
|
|
|
|
|
|
# Netscape::Bookmarks::Link objects. |
337
|
|
|
|
|
|
|
# |
338
|
|
|
|
|
|
|
# =cut |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
sub aliasof { |
341
|
229
|
|
|
229
|
0
|
265
|
my $self = shift; |
342
|
|
|
|
|
|
|
|
343
|
229
|
|
|
|
|
314
|
$self->{'ALIASOF'} |
344
|
|
|
|
|
|
|
} |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
# =item $obj->append_title |
347
|
|
|
|
|
|
|
# |
348
|
|
|
|
|
|
|
# Adds to the title - used mostly for the HTML parser, although it can |
349
|
|
|
|
|
|
|
# be used to add a title if none exists (which is an error, though). |
350
|
|
|
|
|
|
|
# |
351
|
|
|
|
|
|
|
# =cut |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
sub append_title { |
354
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
355
|
0
|
|
|
|
|
0
|
my $text = shift; |
356
|
|
|
|
|
|
|
|
357
|
0
|
|
|
|
|
0
|
$self->{'TITLE'} .= $text; |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
# =item $obj->append_description |
361
|
|
|
|
|
|
|
# |
362
|
|
|
|
|
|
|
# Adds to the description - used mostly for the HTML parser, although |
363
|
|
|
|
|
|
|
# it can be used to add a description if none exists. |
364
|
|
|
|
|
|
|
# |
365
|
|
|
|
|
|
|
# =cut |
366
|
|
|
|
|
|
|
# |
367
|
|
|
|
|
|
|
sub append_description { |
368
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
369
|
0
|
|
|
|
|
0
|
my $text = shift; |
370
|
|
|
|
|
|
|
|
371
|
0
|
|
|
|
|
0
|
$self->{'DESCRIPTION'} .= $text; |
372
|
|
|
|
|
|
|
} |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
# just show me what you think is in the link. i use this for |
375
|
|
|
|
|
|
|
# debugging. |
376
|
|
|
|
|
|
|
# |
377
|
|
|
|
|
|
|
sub print_dump { |
378
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
379
|
|
|
|
|
|
|
|
380
|
0
|
|
|
|
|
0
|
print <<"HERE"; |
381
|
|
|
|
|
|
|
$$self{TITLE} |
382
|
0
|
|
|
|
|
0
|
@{[($$self{HREF})->as_string]} |
383
|
|
|
|
|
|
|
$$self{ADD_DATE} |
384
|
|
|
|
|
|
|
$$self{LAST_MODIFIED} |
385
|
|
|
|
|
|
|
$$self{LAST_VISIT} |
386
|
|
|
|
|
|
|
$$self{ALIASID} |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
HERE |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=item $obj->as_string |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
Returns a Netscape compatible bookmarks file based on the Bookmarks object. |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=cut |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
sub as_string { |
399
|
229
|
|
|
229
|
1
|
287
|
my $self = shift; |
400
|
|
|
|
|
|
|
|
401
|
229
|
|
|
|
|
350
|
my $link = $self->href; |
402
|
229
|
|
|
|
|
1129
|
my $title = $self->title; |
403
|
229
|
|
|
|
|
348
|
my $aliasid = $self->aliasid; |
404
|
229
|
|
|
|
|
315
|
my $aliasof = $self->aliasof; |
405
|
229
|
|
|
|
|
326
|
my $add_date = $self->add_date; |
406
|
229
|
|
|
|
|
367
|
my $last_visit = $self->last_visit; |
407
|
229
|
|
|
|
|
334
|
my $last_modified = $self->last_modified; |
408
|
229
|
|
|
|
|
322
|
my $shortcuturl = $self->shortcuturl; |
409
|
229
|
|
|
|
|
335
|
my $icon = $self->icon; |
410
|
229
|
|
|
|
|
336
|
my $last_charset = $self->last_charset; |
411
|
229
|
|
|
|
|
330
|
my $schedule = $self->schedule; |
412
|
229
|
|
|
|
|
348
|
my $last_ping = $self->last_ping; |
413
|
229
|
|
|
|
|
331
|
my $ping_content_len = $self->ping_content_len; |
414
|
229
|
|
|
|
|
323
|
my $ping_status = $self->ping_status; |
415
|
|
|
|
|
|
|
|
416
|
229
|
100
|
|
|
|
374
|
$aliasid = defined $aliasid ? qq|ALIASID="$aliasid"| : ''; |
417
|
229
|
50
|
|
|
|
305
|
$aliasof = defined $aliasof ? qq|ALIASOF="$aliasof"| : ''; |
418
|
229
|
100
|
|
|
|
371
|
$add_date = $add_date ? qq|ADD_DATE="$add_date"| : ''; |
419
|
229
|
100
|
|
|
|
322
|
$last_visit = $last_visit ? qq|LAST_VISIT="$last_visit"| : ''; |
420
|
229
|
100
|
|
|
|
306
|
$last_modified = $last_modified ? qq|LAST_MODIFIED="$last_modified"| : ''; |
421
|
|
|
|
|
|
|
|
422
|
229
|
50
|
|
|
|
311
|
$shortcuturl = $shortcuturl ? qq|SHORTCUTURL="$shortcuturl"| : ''; |
423
|
229
|
50
|
|
|
|
292
|
$icon = $icon ? qq|ICON="$icon"| : ''; |
424
|
229
|
100
|
|
|
|
318
|
$last_charset = $last_charset ? qq|LAST_CHARSET="$last_charset"| : ''; |
425
|
|
|
|
|
|
|
|
426
|
229
|
100
|
|
|
|
319
|
$schedule = $schedule ? qq|SCHEDULE="$schedule"| : ''; |
427
|
229
|
100
|
|
|
|
290
|
$last_ping = $last_ping ? qq|LAST_PING="$last_ping"| : ''; |
428
|
229
|
100
|
|
|
|
312
|
$ping_content_len = $ping_content_len ? qq|PING_CONTENT_LEN="$ping_content_len"| : ''; |
429
|
229
|
100
|
|
|
|
296
|
$ping_status = $ping_status ? qq|PING_STATUS="$ping_status"| : ''; |
430
|
|
|
|
|
|
|
|
431
|
229
|
|
|
|
|
670
|
my $attr = join " ", grep( $_ ne '', ($aliasid, $aliasof, $add_date, $last_visit, |
432
|
|
|
|
|
|
|
$last_modified, $icon, $schedule, $last_ping, $shortcuturl, $last_charset, |
433
|
|
|
|
|
|
|
$ping_content_len, $ping_status, ) ); |
434
|
|
|
|
|
|
|
|
435
|
229
|
100
|
|
|
|
451
|
$attr = " " . $attr if $attr; |
436
|
|
|
|
|
|
|
|
437
|
229
|
|
|
|
|
325
|
my $desc = ''; |
438
|
229
|
100
|
|
|
|
337
|
$desc = "\n\t" . $self->description if $self->description; |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
#XXX: when the parser gets the Link description, it also picks up |
441
|
|
|
|
|
|
|
#the incidental whitespace between the description and the |
442
|
|
|
|
|
|
|
#next item, so we need to remove this before we print it. |
443
|
|
|
|
|
|
|
# |
444
|
|
|
|
|
|
|
#this is just a kludge though, since we should solve the |
445
|
|
|
|
|
|
|
#actual problem as it happens. however, since this is a |
446
|
|
|
|
|
|
|
#stream parser and we don't know when the description ends |
447
|
|
|
|
|
|
|
#until the next thing starts (since there is no closing DD tag, |
448
|
|
|
|
|
|
|
#we don't know when to strip whitespace. |
449
|
229
|
|
|
|
|
325
|
$desc =~ s/\s+$//; |
450
|
|
|
|
|
|
|
|
451
|
229
|
|
|
|
|
802
|
return qq|$title$desc|; |
452
|
|
|
|
|
|
|
} |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=item $obj->remove |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
Performs any clean up necessary to remove this object from the |
457
|
|
|
|
|
|
|
Bookmarks tree. Although this method does not remove Alias objects |
458
|
|
|
|
|
|
|
which point to the Link, it probably should. |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=cut |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
sub remove { |
463
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
464
|
|
|
|
|
|
|
|
465
|
0
|
|
|
|
|
|
return 1; |
466
|
|
|
|
|
|
|
} |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
"if you want to believe everything you read, so be it." |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
__END__ |