diff --git a/Changelog b/Changelog index 426f610..2e9a8e7 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,10 @@ +1.3.6: +ADDED: Added test cases for "make test" +ADDED: Added test for optional and required perl modules in + Makefile.PL +FIXED: NOTEDB::dumper version string were wrong, therefore + cpan didn't index is properly. +================================================================================ 1.3.5: FIXED: Applied patch by Elmar Loos which fixes misbehavior for -t and -T (identical output) diff --git a/Makefile.PL b/Makefile.PL index 3d85b1b..c3db63f 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,7 +1,39 @@ use ExtUtils::MakeMaker; +my %optional = ( + 'Crypt::CBC' => "Required by encryption support", + 'Crypt::Rijndael' => "Required by encryption support", + 'Data::Dumper' => "Required by dumper DB backend", + 'MIME::Base64' => "Required by varios optional backends", + 'Storable' => "Required by text DB backend", + 'Config::General' => "Required by general DB backend", + 'DB_File' => "Required by dbm DB backend", + 'DBI' => "Required by mysql DB backend", + 'DBD::mysql' => "Required by mysql DB backend" + ); + +foreach my $module (sort keys %optional) { + eval "require $module"; + if ($@) { + warn("Optional module $module no installed, $optional{$module}\n"); + } +} + + WriteMakefile( 'NAME' => 'NOTEDB', 'VERSION_FROM' => 'NOTEDB.pm', # finds $VERSION 'EXE_FILES' => [ 'bin/note' ], + 'PREREQ_PM' => { + 'IO::File' => 0, + 'FileHandle' => 0, + 'File::Spec' => 0, + 'File::Glob' => 0, + 'FileHandle' => 0, + 'Getopt::Long' => 0, + 'Fcntl' => 0, + 'IO::Seekable' => 0, + }, + ($ExtUtils::MakeMaker::VERSION ge '6.31'? ('LICENSE' => 'perl', ) : ()), + 'clean' => { FILES => 't/*.out t/test.cfg *~ */*~' } ); diff --git a/NOTEDB/binary.pm b/NOTEDB/binary.pm index 8e19dbd..b8f5028 100644 --- a/NOTEDB/binary.pm +++ b/NOTEDB/binary.pm @@ -8,9 +8,9 @@ package NOTEDB::binary; $NOTEDB::binary::VERSION = "1.10"; use strict; -#use Data::Dumper; use IO::Seekable; use File::Spec; +use FileHandle; use Fcntl qw(LOCK_EX LOCK_UN); use NOTEDB; @@ -77,7 +77,7 @@ sub set_del_all sub get_single { my($this, $num) = @_; - my($address, $note, $date, $buffer, $n, $t, $buffer, ); + my($address, $note, $date, $n, $t, $buffer, ); open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n"; flock NOTE, LOCK_EX; diff --git a/NOTEDB/dumper.pm b/NOTEDB/dumper.pm index 3ae1ffb..d2445cd 100644 --- a/NOTEDB/dumper.pm +++ b/NOTEDB/dumper.pm @@ -4,7 +4,7 @@ package NOTEDB::dumper; -$NOTEDB::text::VERSION = "1.00"; +$NOTEDB::dumper::VERSION = "1.01"; use strict; use Data::Dumper; diff --git a/bin/note b/bin/note index a8052e4..217cd23 100755 --- a/bin/note +++ b/bin/note @@ -140,7 +140,7 @@ $CONF = File::Spec->catfile($ENV{HOME}, ".noterc"); $USER = getlogin || getpwuid($<); chomp $USER; $TOPIC = 1; -$version = "1.3.5"; +$version = "1.3.6"; $CurDepth = 1; # the current depth inside the topic "directory" structure... $maxlen = "auto"; $timelen = 22; diff --git a/note.pod b/note.pod index c9cc90f..1741e26 100644 --- a/note.pod +++ b/note.pod @@ -530,6 +530,6 @@ Thomas Linden =head1 VERSION -1.3.5 (07/19/2009) +1.3.6 (07/20/2009) =cut diff --git a/t/run.t b/t/run.t new file mode 100644 index 0000000..553d553 --- /dev/null +++ b/t/run.t @@ -0,0 +1,53 @@ +# -*-perl-*- +use Test::More tests => 8; +#use Test::More qw(no_plan); + +BEGIN { use_ok "NOTEDB" }; +require_ok("NOTEDB"); + +require_ok("NOTEDB::binary"); + + +my $db = new NOTEDB::binary(dbname => "t/1.out"); +ok(ref($db), "Database object loaded"); + + + + +my $r = $db->set_new(1, "any new text", "23.12.2000 10:33:02"); +ok($r, "true"); + + + +my $next = $db->get_nextnum(); +if ($next == 2) { + pass("Get next note id"); +} +else { + fail("Get next note id"); +} + + + + + +my ($note, $date) = $db->get_single(1); +if ($note =~ /any new text/) { + ok("Reading note"); +} +else { + fail("Reading note"); +} + + + +my $expect = { + 1 => { + 'date' => '23.12.2000 10:33:02', + 'note' => 'any new text' + } + }; + +my %all = $db->get_all(); +is_deeply($expect, \%all, "Get all notes hash"); +