Oddity assigning to a hash

16 views
Skip to first unread message

Steven Lembark

unread,
May 20, 2009, 4:33:41 PM5/20/09
to DBM-...@googlegroups.com
I'd have thought that:

my $que = DBM::Deep->new( $path );

%$que = ( ... )

would work.

The errors and code are shown below.

Q: Anything obvious I'm doing wrong?

What the code below gives me is:

USE_DBM=1 perl -Mblib t/14-tied-queue-nofork.t
Skip blib/lib/Parallel/Depend/Util.pm (unchanged)
Skip blib/lib/Parallel/Depend.pm (unchanged)
Manifying blib/man3/Parallel::Depend.3
1..32
Can't call method "free" on an undefined value at /opt/perl/5.10.0/lib/site_perl/5.10.0/DBM/Deep/Engine.pm line 1550.
# Looks like your test exited with 9 before it could output anything.

eyeballing this in the debugger gives me a similar error:

DB<3> x $que
0 DBM::Deep::Hash=HASH(0x14a8068)
'before' => DBM::Deep::Hash=HASH(0x14fd8c8)
"\c\\bar" => DBM::Deep::Hash=HASH(0x15173a8)
empty hash
"\c\\foo" => DBM::Deep::Hash=HASH(0x151a168)
"\c\\bar" => undef
'executed' => ''
'files' => DBM::Deep::Hash=HASH(0x151a678)
"\c\\bar" => DBM::Deep::Array=ARRAY(0x1516d98)
0 '/scratch/lembark/tmp/run/14-tied-queue-nofork.bar.run'
1 '/scratch/lembark/tmp/log/14-tied-queue-nofork.bar.out'
2 '/scratch/lembark/tmp/log/14-tied-queue-nofork.bar.err'
"\c\\foo" => DBM::Deep::Array=ARRAY(0x1516cf0)
0 '/scratch/lembark/tmp/run/14-tied-queue-nofork.foo.run'
1 '/scratch/lembark/tmp/log/14-tied-queue-nofork.foo.out'
2 '/scratch/lembark/tmp/log/14-tied-queue-nofork.foo.err'
'group' => DBM::Deep::Hash=HASH(0x151a000)
empty hash
'local' => DBM::Deep::Hash=HASH(0x1516b28)
> Can't call method "free" on an undefined value at /opt/perl/5.10.0/lib/site_perl/5.10.0/DBM/Deep/Engine.pm line 1550.
> at /opt/perl/5.10.0/lib/site_perl/5.10.0/DBM/Deep/Engine.pm line 1550
DBM::Deep::Engine::Sector::Reference::write_data('DBM::Deep::Engine::Sector::Reference=HASH(0x1516c48)', 'HASH(0x151dae8)') called at /opt/perl/5.10.0/lib/site_perl/5.10.0/DBM/Deep/Engine.pm line 147
DBM::Deep::Engine::read_value('DBM::Deep::Engine=HASH(0x14fa470)', 'DBM::Deep::Hash=HASH(0x151ddd0)', '\x{1c}alias') called at /opt/perl/5.10.0/lib/site_perl/5.10.0/DBM/Deep.pm line 514
DBM::Deep::FETCH('DBM::Deep::Hash=HASH(0x151ddd0)', '\x{1c}alias', '\x{1c}alias') called at /opt/perl/5.10.0/lib/site_perl/5.10.0/DBM/Deep/Hash.pm line 35
DBM::Deep::Hash::FETCH('DBM::Deep::Hash=HASH(0x151ddd0)', '\x{1c}alias') called at /opt/perl/5.10.0/lib/5.10.0/dumpvar.pl line 231
dumpvar::unwrap('DBM::Deep::Hash=HASH(0x1516b28)', 6, -3) called at /opt/perl/5.10.0/lib/5.10.0/dumpvar.pl line 144
dumpvar::DumpElem('DBM::Deep::Hash=HASH(0x1516b28)', 6, -3) called at /opt/perl/5.10.0/lib/5.10.0/dumpvar.pl line 233
dumpvar::unwrap('DBM::Deep::Hash=HASH(0x14a8068)', 3, -2) called at /opt/perl/5.10.0/lib/5.10.0/dumpvar.pl line 144
dumpvar::DumpElem('DBM::Deep::Hash=HASH(0x14a8068)', 3, -2) called at /opt/perl/5.10.0/lib/5.10.0/dumpvar.pl line 270
dumpvar::unwrap('ARRAY(0x14ba3a0)', 0, -1) called at /opt/perl/5.10.0/lib/5.10.0/dumpvar.pl line 34
main::dumpValue('ARRAY(0x14ba3a0)', -1) called at /opt/perl/5.10.0/lib/5.10.0/perl5db.pl line 5545
DB::dumpit('GLOB(0x6837b0)', 'ARRAY(0x14ba3a0)') called at /opt/perl/5.10.0/lib/5.10.0/perl5db.pl line 667
DB::eval called at /opt/perl/5.10.0/lib/5.10.0/perl5db.pl line 3434
DB::DB called at /sandbox/lembark/Modules/Parallel-Depend/blib/lib/Parallel/Depend.pm line 83
Parallel::Depend::initial_queue('Testify=SCALAR(0x1042458)', '/sandbox/lembark/Modules/Parallel-Depend/t/../tmp/14-tied-que...') called at /sandbox/lembark/Modules/Parallel-Depend/blib/lib/Parallel/Depend.pm line 865
Parallel::Depend::prepare('Testify=SCALAR(0x1042458)', 'sched', 'foo : bar', 'rundir', '/sandbox/lembark/Modules/Parallel-Depend/t/../tmp/run', 'logdir', '/sandbox/lembark/Modules/Parallel-Depend/t/../tmp/log', 'nofork', 1, ...) called at t/14-tied-queue-nofork.t line 54
# Looks like your test exited with 9 before it could output anything.
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.

thanx

sub initial_queue
{
# return the existing que if it exists otherwise
# install a que if one is supplied otherwise die.

my ( $mgr, $path ) = @_;

my $base = basename $0, '.pl', '.pm', '.t';

my $que
= defined $path
? do
{
require DBM::Deep;

my $path ||= "/tmp/$base.dbm";

DBM::Deep->new( $path )
}
: {}
;

%$que =
(
# track sub-schedules used for groups.
#
# prefix is added before logdir and rundir entries
# with the name to avoid basename collisions for jobs
# aliased in mutiple groups.

namespace => '',

prefix => $base,

# defined by the schedule.
# { prior }{ $job } => jobs that run prior to $job.
# { after }{ $job } => jobs that run after $job.
# runnable uses prior; complete uses after.

before => {}, # jobs running prior to a job starting
after => {}, # jobs running after a job completes
group => {}, # groups by name

alias => {}, # $jobid => alias

# assembled in prepare to track clean jobs on
# restart or failed ones during execution,
# paths for run, log, err files.

skip => {}, # job_id => $reason, 0 => clean.
files => {}, # $job_id => [ run, out, err ]

# flag the schedule as unstarted.
# set to true in execute, avoids accidentally
# re-running the schedule without re-preparing.

executed => '',
);

$mgr2que{ refaddr $mgr } = $que
}

--
Steven Lembark 85-09 90th St.
Workhorse Computing Woodhaven, NY, 11421
lem...@wrkhors.com +1 888 359 3508

Reply all
Reply to author
Forward
0 new messages