Localized time-dependent perturbations in metals : formalism and simple examples