Bifurcation from a periodic orbit in perturbed planar Hamiltonian systems