In an appeal to hard-right conservatives, Gov. Rick Perry of Texas is broadcasting a new campaign ad that seems to contrast Christianity with homosexuality, vows to end what he calls “Obama’s war on religion,” and highlights Mr. Perry’s criticism of overturning the “don’t ask, don’t tell” policy for gays serving in the military.