Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Exception-Class CPAN distribution.

Report information
The Basics
Id: 43600
Status: resolved
Priority: 0/
Queue: Exception-Class

People
Owner: Nobody in particular
Requestors: cbouvi [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.23
Fixed in: 1.27



Subject: please do not use $! as default error message
Hello, I am currently annoyed by Exception::Class assuming that $! is the default cause of any exception. Scenario: - make a system call that fails, e.g., open a non-existing file. $! is set. - decide that this failure is not important and go on. - later, for something completely different, throw an exception, through Exception::Class, but without specifying an 'error' or 'message' argument. - the as_string() method will mention the 'file not found' error that happened earlier, although it is not related to this exception in any way. perlvar says that $! is only set when a system call fails. It is not reset when another system call later succeeds. It is not reset when the error that caused $! to be set is handled. I would suggest to not make $! a default value, and let the calling code decide whether $! should be knowned to the exception or not. Or at least, to keep backward compatibility, provide a subclass for exceptions that have nothing to do with system calls. TIA and best Regards.