in reply to Re^10: eval to replace die?
in thread eval to replace die?
the unreliable part is writing good regular expressions which are not fragile in the face of simple changes to unstructured data.Ah, but at least it's possible.
It's impossible to do plain string compare that isn't fragile in the face of simple changes. If
than any change to either of the strings, how minute, will make$str eq "..."
which is, I think, the point BrowserUK is making.$str ne "..."
Whenever I write an exception system, I throw constants (or objects with a method returning such constants). Constants I export. So, if I were to change the value of a constant, the code would still run correctly (or at least, the programmer has to do some work to write code that doesn't run correctly on such a change). And if I were to change the name of a constant, there's a very high probability of the code no longer compiling. Then I can write code like:
eval {....; 1} or do { given ($@) { when ($EXCEPTION1) {...} when ($EXCEPTION2) {...} default {...} } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: eval to replace die?
by chromatic (Archbishop) on Oct 04, 2010 at 21:20 UTC |