FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
#!/usr/bin/perl
|
2012-02-10 20:24:51 +01:00
|
|
|
# $Id: dbm.pm,v 1.3 2000/08/11 00:05:58 zarahg Exp $
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
# Perl module for note
|
|
|
|
|
# DBM database backend. see docu: perldoc NOTEDB::dbm
|
|
|
|
|
#
|
|
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
package NOTEDB;
|
|
|
|
|
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
use DB_File;
|
2012-02-10 20:24:51 +01:00
|
|
|
use Data::Dumper;
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
use NOTEDB;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
use strict;
|
2012-02-10 20:24:51 +01:00
|
|
|
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# Globals:
|
2012-02-10 20:24:51 +01:00
|
|
|
my (%note, %date);
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
sub new
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $dbdriver, $dbm_dir) = @_;
|
|
|
|
|
my $class = ref($this) || $this;
|
|
|
|
|
my $self = {};
|
|
|
|
|
bless($self,$class);
|
|
|
|
|
|
|
|
|
|
my $notefile = "note.dbm";
|
|
|
|
|
my $timefile = "date.dbm";
|
|
|
|
|
$self->{version} = "(NOTEDB::dbm, 1.2)";
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
tie %note, "DB_File", "$dbm_dir/$notefile" || die $!;
|
|
|
|
|
tie %date, "DB_File", "$dbm_dir/$timefile" || die $!;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
return $self;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub DESTROY
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
# clean the desk!
|
|
|
|
|
untie %note, %date;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub version {
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
return $this->{version};
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
sub get_single
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num) = @_;
|
|
|
|
|
my($note, $date);
|
|
|
|
|
return $this->ude ($note{$num}), $this->ude($date{$num});
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub get_all
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
my($num, $note, $date, %res, $real);
|
|
|
|
|
foreach $num (sort {$a <=> $b} keys %date) {
|
|
|
|
|
$res{$num}->{'note'} = $this->ude($note{$num});
|
|
|
|
|
$res{$num}->{'date'} = $this->ude($date{$num});
|
|
|
|
|
}
|
|
|
|
|
return %res;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub get_nextnum
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num);
|
|
|
|
|
foreach (sort {$a <=> $b} keys %date) {
|
|
|
|
|
$num = $_;
|
|
|
|
|
}
|
|
|
|
|
$num++;
|
|
|
|
|
return $num;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub get_search
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $searchstring) = @_;
|
|
|
|
|
my($num, $note, $date, %res, $match);
|
|
|
|
|
|
|
|
|
|
my $regex = $this->generate_search($searchstring);
|
|
|
|
|
eval $regex;
|
|
|
|
|
if ($@) {
|
|
|
|
|
print "invalid expression: \"$searchstring\"!\n";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$match = 0;
|
|
|
|
|
foreach $num (sort {$a <=> $b} keys %date) {
|
|
|
|
|
$_ = $this->ude($note{$num});
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
eval $regex;
|
2012-02-10 20:24:51 +01:00
|
|
|
if ($match) {
|
|
|
|
|
$res{$num}->{'note'} = $this->ude($note{$num});
|
|
|
|
|
$res{$num}->{'date'} = $this->ude($date{$num});
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
}
|
|
|
|
|
$match = 0;
|
2012-02-10 20:24:51 +01:00
|
|
|
}
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
|
2012-02-10 20:24:51 +01:00
|
|
|
return %res;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub set_recountnums
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
my(%Note, %Date, $num, $setnum);
|
|
|
|
|
$setnum = 1;
|
|
|
|
|
foreach $num (sort {$a <=> $b} keys %note) {
|
|
|
|
|
$Note{$setnum} = $note{$num};
|
|
|
|
|
$Date{$setnum} = $date{$num};
|
|
|
|
|
$setnum++;
|
|
|
|
|
}
|
|
|
|
|
%note = %Note;
|
|
|
|
|
%date = %Date;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub set_edit
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num, $note, $date) = @_;
|
|
|
|
|
$note{$num} = $this->uen($note);
|
|
|
|
|
$date{$num} = $this->uen($date);
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub set_new
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num, $note, $date) = @_;
|
|
|
|
|
$this->set_edit($num, $note, $date); # just the same thing
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub set_del
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this, $num) = @_;
|
|
|
|
|
my($note, $date, $T);
|
|
|
|
|
($note, $date) = $this->get_single($num);
|
|
|
|
|
return "ERROR" if ($date !~ /^\d/);
|
|
|
|
|
delete $note{$num};
|
|
|
|
|
delete $date{$num};
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub set_del_all
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my($this) = @_;
|
|
|
|
|
%note = ();
|
|
|
|
|
%date = ();
|
|
|
|
|
return;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub uen
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
my($T);
|
|
|
|
|
if($NOTEDB::crypt_supported == 1) {
|
|
|
|
|
eval {
|
|
|
|
|
$T = pack("u", $this->{cipher}->encrypt($_[0]));
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$T = $_[0];
|
|
|
|
|
}
|
|
|
|
|
chomp $T;
|
|
|
|
|
return $T;
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub ude
|
|
|
|
|
{
|
2012-02-10 20:24:51 +01:00
|
|
|
my $this = shift;
|
|
|
|
|
my($T);
|
|
|
|
|
if($NOTEDB::crypt_supported == 1) {
|
|
|
|
|
eval {
|
|
|
|
|
$T = $this->{cipher}->decrypt(unpack("u",$_[0]))
|
|
|
|
|
};
|
|
|
|
|
return $T;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return $_[0];
|
|
|
|
|
}
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
}
|
|
|
|
|
|
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
2012-02-10 20:22:49 +01:00
|
|
|
|
|
|
|
|
|
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
it now again...
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
storage.
FIXED: &display-tree returns now, if there is no note, otherwise it
would die because of an undefined refernce.
CHANGED: Changed the config file format completely. It is now no more a perl
file, instead it is a simple plain text file which note parses.
CHANGED: Changed the way, note loads it database backend. It uses now the
$dbdriver variable as module-name, which makes it possible easily
to write your own backend without the need to change note itself.
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
5.6.0 and is not senceful.
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
were case insensitive causing -i to be interpreted as --import
instead of --interactive ;-(((
ADDED: a new config option $DEFAULT_LIST, which causes note, \
if turned to "LONG", to use long-listing as default. |
But it will still be able to use short-listing if you |
explicit specify that. | submitted by
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
case no searchstring was given instead of jumping to | thanks a lot!
usage. |
CHANGED: Changed the text in the interactive help to reflect |
changes of verion 1.0.3 (t and T). /
2012-02-10 20:15:05 +01:00
|
|
|
1; # keep this!
|
|
|
|
|
|
|
|
|
|
__END__
|
|
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
|
|
NOTEDB::dbm - module lib for accessing a notedb from perl
|
|
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
|
|
# include the module
|
|
|
|
|
use NOTEDB;
|
|
|
|
|
|
|
|
|
|
# create a new NOTEDB object (the last 4 params are db table/field names)
|
|
|
|
|
$db = new NOTEDB("mysql","note","/home/user/.notedb/");
|
|
|
|
|
|
|
|
|
|
# get a single note
|
|
|
|
|
($note, $date) = $db->get_single(1);
|
|
|
|
|
|
|
|
|
|
# search for a certain note
|
|
|
|
|
%matching_notes = $db->get_search("somewhat");
|
|
|
|
|
# format of returned hash:
|
|
|
|
|
#$matching_notes{$numberofnote}->{'note' => 'something', 'date' => '23.12.2000 10:33:02'}
|
|
|
|
|
|
|
|
|
|
# get all existing notes
|
|
|
|
|
%all_notes = $db->get_all();
|
|
|
|
|
# format of returnes hash like the one from get_search above
|
|
|
|
|
|
|
|
|
|
# get the next noteid available
|
|
|
|
|
$next_num = $db->get_nextnum();
|
|
|
|
|
|
|
|
|
|
# recount all noteids starting by 1 (usefull after deleting one!)
|
|
|
|
|
$db->set_recountnums();
|
|
|
|
|
|
|
|
|
|
# modify a certain note
|
|
|
|
|
$db->set_edit(1, "any text", "23.12.2000 10:33:02");
|
|
|
|
|
|
|
|
|
|
# create a new note
|
|
|
|
|
$db->set_new(5, "any new text", "23.12.2000 10:33:02");
|
|
|
|
|
|
|
|
|
|
# delete a certain note
|
|
|
|
|
$db->set_del(5);
|
|
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
|
|
You can use this module for accessing a note database. This is the dbm module.
|
|
|
|
|
It uses the DB_FILE module to store it's data and it uses DBM files for tis purpose.
|
|
|
|
|
|
|
|
|
|
Currently, NOTEDB module is only used by note itself. But feel free to use it
|
|
|
|
|
within your own project! Perhaps someone want to implement a webinterface to
|
|
|
|
|
note...
|
|
|
|
|
|
|
|
|
|
=head1 USAGE
|
|
|
|
|
|
|
|
|
|
please see the section SYNOPSIS, it says it all.
|
|
|
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
|
|
|
|
|
|
|
|
Thomas Linden <tom@daemon.de>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=cut
|