Netscape::Bookmarks::Category - manipulate, or create Netscape Bookmarks files
use Netscape::Bookmarks; #parse an existing file my $bookmarks = Netscape::Bookmarks->new( $bookmarks_file ); #print a Netscape compatible file print $bookmarks->as_string;
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 bookmarks file programmatically. One can parse an existing bookmarks file, manipulate the information, and write it as a bookmarks file again. Furthermore, one can skip the parsing step to create a new bookmarks file and write it in the proper format to be used by a Netscape browser.
The Bookmarks.pm module simply parses the bookmarks file passed to it as the only argument to the constructor:
my $bookmarks = new Netscape::Bookmarks $bookmarks_file;
The returned object is a Netscape::Bookmarks::Category object, since the bookmark file is simply a collection of categories that contain any of the components listed above. The top level (i.e. root) category is treated specially and defines the title of the bookmarks file.
The new method creates a Category. It takes a hash reference that specifies the properties of the category. The valid keys in that hash are
folded collapsed state of the category ( 1 or 0 ) title add_date description
The add() function adds an element to a category. The element must be a Alias, Link, Category, or Separator object. Returns TRUE or FALSE.
Adds a description to the category.
Returns title to the category.
Returns the ID of the category. This is an arbitrary, unique number.
Returns the description of the category
Returns the folded state of the category (TRUE or FALSE). If the category is "folded", Netscape shows a collapsed folder for this category.
Returns the ADD_DATE attribute of the category.
Returns an array reference to the elements in the category.
Returns a list of the Category objects in the category.
Returns a list of the Link objects in the category.
Returns an HTML string representation of the category, but not the elements of the category.
Returns an HTML string representation of the category as the top level category, along with all of the elements of the category and the Categories that it contains, recursively.
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.
brian d foy, <bdfoy@cpan.org>
<bdfoy@cpan.org>
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.
Netscape::Bookmarks
To install Netscape::Bookmarks, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Netscape::Bookmarks
CPAN shell
perl -MCPAN -e shell install Netscape::Bookmarks
For more information on module installation, please visit the detailed CPAN module installation guide.