NAME

Netscape::Bookmarks::Link - manipulate, or create Netscape Bookmarks links

SYNOPSIS

use Netscape::Bookmarks::Link;

my $category = new Netscape::Bookmarks::Category { ... };
my $link = new Netscape::Bookmarks::Link {
		TITLE         => 'this is the title',
		DESCRIPTION   => 'this is the description',
		HREF          => 'http://www.perl.org',
		ADD_DATE      => 937862073,
		LAST_VISIT    => 937862073,
		LAST_MODIFIED => 937862073,
		ALIAS_ID      => 4,
		}

$category->add($link);


#print a Netscape compatible file
print $link->as_string;

DESCRIPTION

The Netscape bookmarks file has several basic components:

title
folders (henceforth called categories)
links
aliases
separators

On disk, Netscape browsers store this information in HTML. In the browser, it is displayed under the "Bookmarks" menu. The data can be manipulated through the browser interface.

This module allows one to manipulate the links in for a Netscape bookmarks file. A link has these attributes, only some of which may be present:

title
description
HREF (i.e. URL)
ADD_DATE
LAST_MODIFIED
LAST_VISIT
ALIAS_OF
ALIAS_ID

Additionally, Mozilla (the open source version of Navigator) uses these attributes:

SHORTCUTURL
ICON
SCHEDULE
LAST_PING
LAST_CHARSET
PING_CONTENT_LEN
PING_STATUS

METHODS

Creates a new Link object. The hash reference argument can have the following keys to set the properties of the link:

HREF
ADD_DATE
LAST_MODIFIED
LAST_VISIT
ALIASID
ALIASOF

SHORTCUTURL
ICON
LAST_CHARSET
$obj->href

Returns the URL of the link. The URL appears in the HREF attribute of the anchor tag.

$obj->add_date

Returns the date when the link was added, in Unix epoch time.

$obj->last_modified

Returns the date when the link was last modified, in Unix epoch time. Returns zero if no information is available.

$obj->last_visit

Returns the date when the link was last vistied, in Unix epoch time. Returns zero if no information is available.

$obj->title( [ TITLE ] )

Sets the link title with the given argument, and returns the link title. If the argument is not defined (e.g. not specified), returns the current link title.

$obj->description( [ DESCRIPTION ] )

Sets the link description with the given argument, and returns the link description. If the argument is not defined (e.g. not specified), returns the current link description.

$obj->alias_id

Returns the alias id of a link. Links with aliases are assigned an ALIAS_ID which associates them with the alias. The alias contains the same value in it's ALIAS_OF field. The Netscape::Bookmarks::Alias module handles aliases as references to Netscape::Bookmarks::Link objects.

$obj->shortcuturl
$obj->icon
$obj->schedule
$obj->last_ping
$obj->ping_content_len
$obj->ping_status
$obj->last_charset
$obj->as_string

Returns a Netscape compatible bookmarks file based on the Bookmarks object.

$obj->remove

Performs any clean up necessary to remove this object from the Bookmarks tree. Although this method does not remove Alias objects which point to the Link, it probably should.

TO DO

* Add methods for manipulating attributes

AUTHOR

brian d foy <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Copyright © 2002-2016, brian d foy <bdfoy@cpan.org>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Netscape::Bookmarks