New to “Error Handling”

There’s much to update in Chapter 12, “Error Handling”. I thought this would be an easy chapter.

Since v5.10, Fatal is different and now called autodie. I mostly had to change the module names. The biggest change was removing the non-void non-handling of builtins that Fatal could do. If Fatal saw I checked the return value of a builtin myself, it doesn’t throw the exception for me. I excised that paragraph.

In v5.14 the behavior of $@ changes quite a bit. An eval inside a destructor won’t mess up $@ as the scope is cleaning up.

I’m covering Try::Tiny and TryCatch. I’m still working on those sections.

Do you have anything else I should include or update? See what I have so far by reading it through Atlas.

2 thoughts on “New to “Error Handling””

  1. I personally recommend against using TryCatch; it’s heavy weight and hard to maintain, which means that if there are bugs (like when it was broken for half a year on 5.12) most perlers can’t help fix it.

  2. Please can you mention that if you use autodie, you’ll have to pay quite a big startup slowdown penalty: if your application has 50 modules, and you use autodie in all these modules (with the default config), it’ll slow down your startup. Because autodie is scoping the functions wrapping, it has to do the wrapping in every modules you’re loading it into. That may be an issue if you’re trying to optimize the starting time. If you’re using even finer scoping of autodie, it may be even worse.

    Not a show stopper, and I recommend using autodie everywhere, but definitely something worth mentioning.

    my 2 cents :)

Comments are closed.