On the role of first integrals in the perturbation of periodic solutions