Giter VIP home page Giter VIP logo

dbm-deep's People

Contributors

aburch avatar adamkennedy avatar drhyde avatar dsteinbrunner avatar esobchenko avatar garu avatar gregoa avatar jes avatar jettero avatar robkinyon avatar shlomif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dbm-deep's Issues

Numerical values are stored as strings

When storing a number (e.g. 42) in DBM::Deep, it is retrieved as a string (e.g. "42"). This is generally not a problem unless you generate JSON and pass that onto Javascript which trips on this.

Example code:

use DBM::Deep;
use Devel::Peek;

my $v = 3.14;

my $db = DBM::Deep->new( "foo.db" );
$db->{s} = $v;

my $n_scalar = $v;
my $n_db = $db->{s};
my $n_db_add = $db->{s} + 0.0;

print "=====> Value:\n";
print Dump $n_scalar;
print "=====> Value run through db:\n";
print Dump $n_db;
print "=====> Value after conversion to number again:\n";
print Dump $n_db_add;

resulting in the following output:

SV = NV(0x7faed302d810) at 0x7faed302d828
  REFCNT = 1
  FLAGS = (NOK,pNOK)
  NV = 3.14
=====> Value run through db:
SV = PVNV(0x7faed30034f0) at 0x7faed302d840
  REFCNT = 1
  FLAGS = (POK,pPOK)
  IV = 0
  NV = 0
  PV = 0x7faed2d5d110 "3.14"\0
  CUR = 4
  LEN = 10
=====> Value after conversion to number again:
SV = NV(0x7faed302d858) at 0x7faed302d870
  REFCNT = 1
  FLAGS = (NOK,pNOK)
  NV = 3.14

The crucial bit is the NOK in the FLAGS section (IOK for integers, etc.).

Synchronise with DBM-Deep-2.0015.tar.gz

For some reason I cannot push to github right now. (Something about a TLS version problem. Looks as though I need a system upgrade.)

In any case, I have released DBM-Deep-2.0015.tar.gz (necessary for compatibility with perl 5.28) without pushing the changes to github.

This ticket is a reminder mostly for myself. But if someone wants to beat me to it, I have the patches. Just e-mail me at my sprout cpan address.

Can't call method "get_next_key" on an undefined value at /usr/share/perl5/DBM/Deep/Engine.pm

When trying to step through multi-level hashes I get "Can't call method "get_next_key" on an undefined value at /usr/share/perl5/DBM/Deep/Engine.pm" whenever I use "next_key".

I've built a Fedora 18 VM on ESXi to just double check that it IS a Raspberry Pi thing (as Pidora is based on F18), and it turns out - it's not....

Build is Fedora 18, 32-bit, from Live CD. I've installed XFCE and the necessary perl modules, plus I've compiled in the Audio:Scan module (which needed little more than make, gcc and zlib-devel).

Running exactly the same test script, as soon as I try to walk through the hash table I hit the problem (see below for output).

So this would seem to be unrelated to the fact I'm running on the Raspberry Pi, but something to do with Fedora 18? Anyway, thought you might want to know as I guess it's much easier for you to troubleshoot as I'm sure you can spin up an F18 locally pretty quickly.

[jon@localhost CaravanCoding]$ uname -a

Linux localhost.localdomain 3.9.6-200.fc18.i686 #1 SMP Thu Jun 13 19:29:40 UTC 2013 i686 i686 i386 GNU/Linux

[jon@localhost CaravanCoding]$ perl -v

This is perl 5, version 16, subversion 3 (v5.16.3) built for i386-linux-thread-multi

[jon@localhost CaravanCoding]$ perl -d musictest.pl

Loading DB routines from perl5db.pl version 1.37
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

defined(%hash) is deprecated at CecilMods/Music.pm line 1097.
at CecilMods/Music.pm line 1097.
require CecilMods/Music.pm called at musictest.pl line 11
main::BEGIN() called at CecilMods/Music.pm line 1097
eval {...} called at CecilMods/Music.pm line 1097
(Maybe you should just omit the defined()?)
at CecilMods/Music.pm line 1097.
require CecilMods/Music.pm called at musictest.pl line 11
main::BEGIN() called at CecilMods/Music.pm line 1097
eval {...} called at CecilMods/Music.pm line 1097
defined(%hash) is deprecated at CecilMods/Music.pm line 1188.
at CecilMods/Music.pm line 1188.
require CecilMods/Music.pm called at musictest.pl line 11
main::BEGIN() called at CecilMods/Music.pm line 1188
eval {...} called at CecilMods/Music.pm line 1188
(Maybe you should just omit the defined()?)
at CecilMods/Music.pm line 1188.
require CecilMods/Music.pm called at musictest.pl line 11
main::BEGIN() called at CecilMods/Music.pm line 1188
eval {...} called at CecilMods/Music.pm line 1188
CecilMods::Music is successfully loaded!
at CecilMods/Music.pm line 24.
require CecilMods/Music.pm called at musictest.pl line 11
main::BEGIN() called at CecilMods/Music.pm line 0
eval {...} called at CecilMods/Music.pm line 0
main::(musictest.pl:13): my $loop = Glib::MainLoop->new();
DB<1> c
CecilMods::Music DB unusable - reinitialising...
at CecilMods/Music.pm line 84.
Music::initialise('Music=HASH(0x9b1f1a0)') called at CecilMods/Music.pm line 72
Music::new('Music') called at musictest.pl line 15
Music object created
Data dumper says '.
$VAR1 = bless( {
'_QL_TRACKS' => [],
'_FF_NODE' => undef,
'_CURRENT_TRACK' => undef,
'_MDB' => bless( {
'TRACKTABLE' => bless( {}, 'DBM::Deep::Hash' ),
'ALBUMTABLE' => bless( {}, 'DBM::Deep::Hash' ),
'ARTALBTABLE' => bless( {}, 'DBM::Deep::Hash' ),
'ARTTRKTABLE' => bless( {}, 'DBM::Deep::Hash' ),
'SAVESTATE' => bless( {}, 'DBM::Deep::Hash' )
}, 'DBM::Deep::Hash' ),
'_PLAYLIST_MAXLEN' => 100,
'_DBFILE' => 'CecilMusicDB.db',
'_FILEREAD_POS' => 0,
'_PLAYLIST' => undef,
'_CURRENT_LENGTH' => undef,
'_FILEREAD_ACT' => 0,
'_FILEREAD_TOT' => 0,
'_PLAYER' => bless( {}, 'GStreamer::Pipeline' ),
'_CURRENT_POS' => undef,
'_QL_ARTISTS' => [],
'_FILEREAD_SUC' => 0,
'_MEDIA_DIR' => '/home/jon/Music/',
'_PLAYLIST_CHANGED' => 0,
'_STATE' => 'READY'
}, 'Music' );

Running FindFile Test
Supported media is: '.mp3','.m4a','.m4p','.mp4'
New Album : Dirt Disc: 1/1 - Alice In Chains
New Artist Found: Alice In Chains
New Album : Nothing Safe: Best Of The Box Disc: 1/1 - Alice In Chains
New Album : Rock In A Hard Place Disc: 1/1 - Aerosmith
New Artist Found: Aerosmith
New Album : Night In The Ruts Disc: 1/1 - Aerosmith
New Album : Permanent Vacation Disc: 1/1 - Aerosmith
New Album : Draw The Line Disc: 1/1 - Aerosmith
MUSIC MOD: Alice In Chains: DBM::Deep::Hash=HASH(0xb754850) retrieved. (this is the first_key - which points to a hash of albums by that Artist)
Can't call method "get_next_key" on an undefined value at /usr/share/perl5/vendor_perl/DBM/Deep/Engine.pm line 258.
at /usr/share/perl5/vendor_perl/DBM/Deep/Engine.pm line 258.
DBM::Deep::Engine::get_next_key('DBM::Deep::Engine::File=HASH(0xa4ea3c0)', 'DBM::Deep::Hash=HASH(0xb754520)', 'Alice In Chains') called at /usr/share/perl5/vendor_perl/DBM/Deep/Hash.pm line 97
DBM::Deep::Hash::NEXTKEY('DBM::Deep::Hash=HASH(0xa652b58)', 'Alice In Chains') called at /usr/share/perl5/vendor_perl/DBM/Deep/Hash.pm line 107
DBM::Deep::Hash::next_key('DBM::Deep::Hash=HASH(0xa652b58)', 'Alice In Chains') called at CecilMods/Music.pm line 637
Music::generate_ql_artists('Music=HASH(0x9b1f1a0)') called at CecilMods/Music.pm line 859
Music::scanmediadir('Music=HASH(0x9b1f1a0)') called at musictest.pl line 22
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<1> q
[jon@localhost CaravanCoding]$

Test failures on perl 5.26 because . isn't in @INC

eg ...

Can't locate t/common.pm in @INC (you may need to install the t::common module) 
(@INC contains: /home/david/cpantesting/perl-5.26.0/.cpan/build/DBM-Deep-2.0013-
0/blib/lib /home/david/cpantesting/perl-5.26.0/.cpan/build/DBM-Deep-2.0013-0/bli
b/arch /home/david/cpantesting/perl-5.26.0/.cpan/build/DBM-Deep-2.0013-0/_build/
lib /home/david/cpantesting/perl-5.26.0/lib/site_perl/5.26.0/x86_64-linux-thread
-multi /home/david/cpantesting/perl-5.26.0/lib/site_perl/5.26.0 /home/david/cpan
testing/perl-5.26.0/lib/5.26.0/x86_64-linux-thread-multi /home/david/cpantesting
/perl-5.26.0/lib/5.26.0) at t/01_basic.t line 6.
BEGIN failed--compilation aborted at t/01_basic.t line 6.
t/01_basic.t ....................
Dubious, test returned 2 (wstat 512, 0x200)

The solution is to use lib 't'; use common;.

Memory leak with hash in version 2.0011

I have discovered a memory leak in the latest version when trying to use a tied hash. After simplifying the code, I see the same behavior with a simple key/value store, and this behavior is seen with the OO interface or a tied hash.

It should be easy to replicate. For reference, I posted this question on StackOverflow and someone commented that they could also replicate this issue. I could provide more information if needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.