brian d foy > Netscape-Bookmarks > Netscape::Bookmarks::Link

Download:
Netscape-Bookmarks-1.95.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.9   Source  

NAME ^

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

SYNOPSIS ^

  use Netscape::Bookmarks::Bookmarks;

  my $category = Netscape::Bookmarks::Category->new( { ... } );
  my $link = Netscape::Bookmarks::Link->new( {
                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

These are explained below.

Methods

Netscape::Bookmarks::Link->new( \%hash )

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
$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

Returns the link title.

$obj->description

Returns the 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->as_string

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

TO DO ^

        Add methods for manipulating attributes

SOURCE AVAILABILITY ^

This source is part of a SourceForge project which always has the latest sources in CVS, as well as all of the previous releases.

        http://sourceforge.net/projects/nsbookmarks/

If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.

AUTHOR ^

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (c) 2002-2007 brian d foy. 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

syntax highlighting: