Professor with terminal cancer uses illness to teach