while(1) { eval { do_this(); do_that(); fork_and_stuff(); and_why_not_do_this_as_well(); }; if( $@ ) { undo_changes(); log( "there was, like, something wrong: $@" ); } }