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.
Hrmmm (Score:2, Insightful)
definedon the return value and you have a clean test for whether a module call has succeeded. It could be much worseAll of this is moot if the module doesn't work though
:-)Reply to This
Re:Hrmmm (Score:3, Informative)
Isn't too bad? - I guess so. But they are stomping in the
main::namespace (rather than the caller's). Using fixed variables means that they are not threadsafe (at least in a 5.005 threads world, or anything non-perl that has POSIX-like threads semantics). Either point alone would be enough for me to toss this code back.Re:Hrmmm (Score:1)
main::namespace (rather than the caller's). Using fixed variables means that they are not threadsafe (at least in a 5.005 threads world, or anything non-perl that has POSIX-like threads semantics).Wholly agreed. The practice of manipulating variables within the
main::namespace would be something which I too would question. Not necessarily from the perspective of thread safety but for more pragmatic reasons relating to professional (developer) courtesy - Playing in other peoRe:Hrmmm (Score:1)
And consider what happens if your function can legitimately return values from 0 upwards, or can fail. For instance "I updated 0 files in the specified directory" vs "I couldn't open the specified directory". In that case, I like to return undef for failure.