Not really a perl question, per se, but OK. If
- You are lazy (and if you are a programmer, you probably are)
- You are running on *nix
- The restart does not have to be immediate
- You don't need to have logic to diagnose chronic/constant failures
Then add a
cron job that runs every couple of minutes and starts it if it is not there. Not pretty, but 15 minute's work, tops.