NAME
ZConf::Bookmarks - ZConf backed bookmark storage system.
VERSION
Version 0.2.4
SYNOPSIS
use ZConf::Bookmarks;
my $zbm = ZConf::Bookmarks->new();
METHODS
new
This initializes it.
One arguement is taken and that is a hash value.
hash values
autoinit
If this is set to true, it will automatically call init the set and config. If this is set to false or not defined, besure to check '$zbm->{init}' to see if the config/module has been initiated or not.
If it is not specified, it will default to true.
set
This is the set to load initially.
zconf
If this key is defined, this hash will be passed to ZConf->new().
my $zbm=ZConf::Bookmarks->new();
if($zbm->{error}){
print "Error!\n";
}
addBookmark
This adds a bookmark for a specified scheme.
Only one arguement is accepted and that is a hash. Please see the below for a list of keys.
hash args
name
This is name for a book mark.
description
This is a description for the bookmark.
link
This is the URI, minus scheme. Thus 'http://vvelox.net/' would become 'vvelox.net'.
scheme
This is the scheme it should be added it. If it is not in lower case it will be converted to it.
my %newBM;
$newBM{description}='VVelox.net';
$newBM{name}='VVelox.net';
$newBM{link}='vvelox.net';
$newBM{scheme}='http';
$zbm->modBookmark(%newBM);
if($zbm->{error}){
print "Error!\n";
}
bookmarkExists
This verifies a bookmark ID exists for a specified scheme.
You do have to check the return value as it will contain if it exists or not. $zbm->{error} is only true if there is an error and for this the bookmark ID not existing is not considered an error.
my $returned=$zbm->bookmarkExists($scheme, $bmid);
if($zbm->{error}){
print "Error!\n";
}else{
if($returned){
print "It does exist.\n";
}else{
print "It does not exist.\n";
}
}
delBookmark
This removes a bookmark.
Two arguements are required. The first is the scheme and the second is the bookmark.
$zbm->delBookmark($scheme, $bmid);
if($zbm->{error}){
print "Error\n";
}
getBookmark
This reads a returns a bookmark.
Two arguements are accepted. The first is the scheme and the second is the bookmark ID.
my %bookmark=$zbm->get($scheme, $bmID);
if($zbm->{error}){
print "Error!\n";
}
getSet
This gets what the current set is.
my $set=$zbm->getSet;
if($zbm->{error}){
print "Error!\n";
}
init
This initializes it or a new set.
If the specified set already exists, it will be reset.
One arguement is required and it is the name of the set. If it is not defined, ZConf will use the default one.
#creates a new set named foo
$zbm->init('foo');
if($zbm->{error}){
print "Error!\n";
}
#creates a new set with ZConf choosing it's name
$zbg->init();
if($zbm->{error}){
print "Error!\n";
}
listBookmarks
This lists the currently setup bookmark IDs for a scheme.
Only one arguement is accepted and that is the scheme to look under.
my @bookmarkIDs=$zbm->listBookmarks('http');
if($zbm->{error}){
print "Error!\n";
}
listSchemss
This lists the current schemes available to choose from.
my @schemes=$zbm->listSchemes();
if($zbm->{error}){
print "Error!\n";
}
listSets
This lists the available sets.
my @sets=$zbm->listSets;
if($zbm->{error}){
print "Error!";
}
modBookmark
Modify a bookmark.
Only one arguement is accepted and it is a hash. Please see the hash information below for the required keys.
hash args
bmid
The bookmark ID to be changed.
name
This is name for a book mark.
description
This is a description for the bookmark.
link
This is the URI, minus scheme. Thus 'http://vvelox.net/' would become 'vvelox.net'.
scheme
This is the scheme it should be added it.
my %newBM;
$newBM{bmid}=$bmid;
$newBM{description}='VVelox.net';
$newBM{name}='VVelox.net';
$newBM{link}='vvelox.net';
$newBM{scheme}='http';
$zbm->modBookmark(%newBM);
if($zbm->{error}){
print "Error!\n";
}
schemeExists
This checks if a scheme has any thing setup or not.
Only one option is accepted and that is the scheme to check for.
You do have to check the return value as it will contain if it exists or not. $zbm->{error} is only true if there is an error and for this the scheme not existing is not considered an error.
my $returned=$zbm->schemeExists('http');
if($zbm->{error}){
print "Error!\n";
}else{
if($returned){
print "It exists.\n";
}else{
print "It does not exists.\n";
}
}
readSet
This reads a specific set. If the set specified is undef, the default set is read.
#read the default set
$zcr->readSet();
if($zcr->{error}){
print "Error!\n";
}
#read the set 'someSet'
$zcr->readSet('someSet');
if($zcr->{error}){
print "Error!\n";
}
errorblank
This blanks the error storage and is only meant for internal usage.
It does the following.
$self->{error}=undef;
$self->{errorString}="";
ERROR CODES
1
Could not initialize ZConf.
2
ZConf error.
3
Missing a required arguement.
4
The highly unlikely event that there a duplicate bookmark ID exists after three attempts to generate one has happened. If this happens, it means your the local time function, or your system clock, and rand number generator are fragged.
5
For some uber add the use of setVar here failed.
6
Bookmark does not exist.
7
Scheme does not exist.
AUTHOR
Zane C. Bowers, <vvelox at vvelox.net>
BUGS
Please report any bugs or feature requests to bug-zconf-bookmarks at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ZConf-Bookmarks. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc ZConf::Bookmarks
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2009 Zane C. Bowers, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.