[Koha-bugs] [Bug 6990] TransformKohaToMarc enhancement

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jan 30 00:59:48 CET 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6990

--- Comment #28 from Janusz Kaczmarek <januszop at gmail.com> 2012-01-29 23:59:48 UTC ---
OK, the possible reason for the error is the line 1842:

next unless my $dtm = $db_to_marc->{''}->{$name};

It seems that (at least in mod_perl environment) the expression 

$dtm = $db_to_marc->{''}->{$name}

is always true. Even if for some $name-s (such as item.timestamp or
items.more_subfields_xml) the is no entry in $db_to_marc, the logical value of
this assignment is true -- it seems that the result of that assignment is a
reference to an empty array [] (debugged with Data::Dumper).  

[[[  Cf. the following example:

#!/usr/bin/perl
my @s = qw //;
print "Hello!\n" if my $a = \@s;

Result: "Hello!" (yes!)

If you add:

use Data::Dumper;
print Dumper $a;

you get: $VAR1 = [];   ]]]

So, for the code to behave more stable one could change the line 1842 with:

my $dtm = $db_to_marc->{''}->{$name};
next unless $dtm->[0];

It seems to be OK. 

What is your opinion?

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list