NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
D’uh (Score:1)
Your “minimal” example was far from minimal so I suspected the wrong things for a long time… I guess that was your point. This was compounded by the fact that I have neither ProdDev::DBConnection nor a desire to install Exporter::NoWork, so I could only read and guess run than run it and poke around. Once I suspected the right thing I found the problem in 30 seconds; then I had to spend another 5 to rewrite to an actual minimal example to confirm the fix (ROT13ed):
Re: (Score:2)
You're correct about my posting the other stuff to make it a bit more obscure since that's how things work in real life. I could have just posted the tests and said "that's enough to find the bug", but that would have made it too easy.
Your solution, by the way, is correct. Of course, you knew that :)
Re:D’uh (Score:1)
Yeah. I admit that I might have been stumped far longer if I hadn’t read about this particular trap before, though I would have found it eventually. With knowledge of how the machinery in Perl works, it’s tractable, if not obvious.
The average J. Random Perlhacker doesn’t know enough though, I suspect, that they could track this down without help. I have often wondered if my fix shouldn’t be applied automatically on failures of the kind you deliberately caused. It also leads me to think that such checks should be delayed from compile time if you can at all help it – if yours were in
import, say, you’d have avoided this headscratching moment.(On an unrelated note, Exporter::NoWork makes me shudder… way too implicit. Give me Exporter::Tidy any day…)
Reply to This
Parent
Re: (Score:2)
I feel a bit odd about using Exporter::NoWork, but it's standard here, so that's what I go with unless I need fine-grained control.