  We study the interaction of a V-type atom in a cavity with incident single-
and two-photon wavepackets and derive an exact formula, valid in all parameter
regimes, relating the spectrum of the outgoing wavepackets to the incident one.
We present detailed results for several special input pulses, and consider the
potential performance of the system as a CPHASE gate for initial pulses in a
product state. We find values of the cavity, atomic and pulse parameters that
yield a conditional phase shift of $\pi$, albeit with a relatively small
overlap between the incoming and outgoing pulse forms.
