in reply to Re^2: return from subfunction
in thread return from subfunction

This sort of “specialized knowledge” about the return-codes should be encapsulated within a sub within that package.   If the caller wants to know, “is this an error?”, then it should be able to get the answer by calling a sub which answers that question, yes or no.   Because, someday, that’s gonna change, and when it does, you do not want to be grepping through the source-folder, finding 100 occurrences of logic that must be changed, and changing (oops...) 99 of them.

Code defensively.   If a call occurs in an “impossible” situation, check for that situation, and (Carp) confess the sin.   The best – the only – agent that can detect such bugs is the computer itself.   Nothing is more “inefficient” than a bug, and the time spent trying to find it.