Perl: the Markov chain saw | |
PerlMonks |
Re^5: Warnings on unused variables?by ikegami (Patriarch) |
on Sep 27, 2008 at 22:58 UTC ( [id://714076]=note: print w/replies, xml ) | Need Help?? |
close will never fail, cause all we want to do is create the file.
But that's a dozen of characters of unnecessary code. For just one line of code! I'd have useless code all over the place. Code that can do nothing but introduce errors, since it doesn't serve any function.
No. Since you believe in closing everything explicitly, the warning won't help you there.
Furthermore, autodie is a great module for testing errors on close, and it doesn't reference the file handle explicitly.
No, the constructor obtains the lock. The object is the lock.
You've never used threads? And constructors are routinely called names other than new.
To properly release the lock when an exception occurs or when return is used more than once.
I'd rather avoid doing away with exceptions, I'd rather my code doesn't throw spurious warnings, and I'd rather not have to us no warnings; all over the place. That's why it's better checked by a linter or until turned on explicitly (meaning -v and use warnings; wouldn't enable it).
You say deallocation of resources on block exit worthy of a warning? Every single variable in Perl does that!
In Section
Seekers of Perl Wisdom
|
|