As mentioned in a previous question, the Shulkhan Aruch, O''C 551:18 writes:
צריך ליזהר מי"ז בתמוז עד ט' באב שלא לילך יחידי מד' שעות עד ט' שעות (משום שבהם קטב מרירי שולט) ; ולא יכו התלמידים בימים ההם.
From the Seventeenth of Tamuz until the Ninth of Av one needs to be careful not to walk alone from the fourth hour of the day until the ninth hour (because during these days [the demon] ketev meriri has control); and one should not beat students during those days.
Why would anyone beat their students to begin with? Can someone explain the rationale behind this halakha as it relates to the rest of the year? Does the halakha sanction corporal punishment in the classroom?