in reply to Self resurrecting perl scripts

I have not tried this myself, so take this with a grain (handful, or other suitable quantity) of salt. die is "just a function". In your code, I'm assuming you are using something like get_the_file() || die; Replace the "die;" with "get_the_file_failed();" and then write a function/handler for that condition. Extend as necessary to handle your other conditions. You only have to have the function to the left of || return true on success.