Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Avoid warning about closing unopened filehandle during destruction #2

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

thaljef commented Nov 21, 2012

If the filehandle isn't open, then closing it throws a warning. This could happen if the application blows up before the logging ever starts. So to avoid the warning, we check if the filehandle is open before trying to close. Scalar::Util::openhandle seems to be best way to do this. Using tell() throws the same warning, and fileno() doesn't always give the right answer.

Update lib/Log/Dispatch/File.pm
If the filehandle isn't open, then closing it throws a warning.  This could happen if the application blows up before the logging ever starts.  So to avoid the warning, we check if the filehandle is open before trying to close.  Scalar::Util::openhandle seems to be best way to do this.  Using tell() throws the same warning, and fileno() doesn't always give the right answer.

thaljef commented Dec 6, 2012

Any chance of getting this pulled in the next week?

Contributor

autarch commented Jul 1, 2013

Apparently I merged this a long time ago but never closed the pull req.

@autarch autarch closed this Jul 1, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment