It's embarrassing how often the simple act of documenting your problem leads you to find the cause. In this case, I had a variable ($handle) defined both locally and globally - an old, old story. Fixing that did get me past the problem I described above, not surprisingly. Now of course there is another problem, but I'll consider that one myself a little more before asking for help.
--- Marais