Cat punishment versus divine intervention
Anyone with reasonable knowledge of cat guardianship knows that punishing a domestic cat is pointless. It’s worse than pointless. It achieves an objective which is unintended: it frightens a cat to the point where they might avoid their human companion depending on the severity of the punishment. Cat training through punishment – negative reinforcement to use training language – is using a human concept (punishment) on a cat.

Punishing a cat is unkind and ineffective. Illutration by Ruth aka Kattaddorra.
Punishment
For punishment to work it requires that the recipient of the punishment understands that they have done something wrong and are being punished for it (suffer negative consequences). It is a quite an advanced emotional concept beyond a cat’s comprehension and demands self-awareness. The truth is that people punish cats not when they have done something wrong but when they have done something which they do not like. They are very different concepts. Also a cat has to link their act (which they consider normal behaviour) with the punishment. Are you sure they get the message? I’d suggest not. There are a gazillion things wrong with it.
Divine intervention
But divine intervention is different. But it looks similar. It is about actions and unpleasant consequences. The classic is putting some tin foil on a kitchen counter top. Your cat jumps on and immediately jumps off because the surface is an unknown quantity and scary. The cat does not connect (associate) the foil with her human guardian and so will not be scared of him or her. It is not punishment. Another example is a cat jumping onto a surface that the owner wants her cat to stay off. Her cat passes through an infra red beam which sets off an alarm. Her cat does not like it and jumps off. Both of these deterrents are “acts of God” from the cat’s perspective. They are freestanding negative consequences unconnected to a person.
Your objective is to train into your cat that a certain action results in something mildly unpleasant so that she modifies her behaviour to avoid the unpleasantness.
Caveat
Personally I don’t endorse this form of feline training even if it is not punishment. However, I do understand it and I do understand that some decent cat owners want their cat to stay away from certain places in the home. Divine intervention and not punishment is the way to do it. But it must be done as gently and as sympathetically as possible. No decent cat owner wants to deliberately make their cat feel frightened of something or unnerved by anything. It goes against the grain of good cat guardianship. You don’t want to put your cat through it. Just make sure that they are (1) unharmed and (2) there is no connection between you and your cat in the mind of your cat.
Positive reinforcement
The better way to mould a cat’s behavior, if this is important to you, is to use positive reinforcement. The trouble is that it takes more thought and more time. This is partly why some owners grab the squirt bottle. There are a lot of pages on training cats on this site. Please search for them using the custom search tool.
Some more on cat punishment

Should I rub my cat’s nose in his pee?
Read More

Do cats understand “No”?
Read More

Are spray bottles effective on cats?
Read More

I hit my cat very hard a couple times for biting my new kitten very badly. Now he walks away when I touch him. What should I do?
Read More

Should I use a spray bottle on my cat?
Read More

Man meows loudly at his sleeping cat to take revenge for being woken up
Read More

If your cat’s behaviour is driving you nuts try timeout
Read More

Jackson Galaxy on Feline Punishment
Read More