Perturbation density functional theory for inhomogeneous fluids