You're right, Jakob, you have a lot of mods in here! I think I have bitten off far more than I can chew in trying to identify the cause of the error :(
I noticed a couple oddities, things I really didn't understand what was happening or why - all in all though, it was not obvious to me what may be going wrong. I did run your scripts thru a perl check and no errors in syntax were reported.
I do have one question though $db_key_track = 1; Since you are using 'LfdNr' (user input) for your db key, why would you have dbman tracking the count?
I am really sorry I haven't been more help on this!
I noticed a couple oddities, things I really didn't understand what was happening or why - all in all though, it was not obvious to me what may be going wrong. I did run your scripts thru a perl check and no errors in syntax were reported.
I do have one question though $db_key_track = 1; Since you are using 'LfdNr' (user input) for your db key, why would you have dbman tracking the count?
I am really sorry I haven't been more help on this!