Danny, the Champion of the World

This article's plot summary may be too long or excessively detailed. Please help improve it by removing unnecessary details and making it more concise. (August 2016) (Learn how and when to remove this template message)
In 1955, William Smith (Jeremy Irons), a widower, lives with his nine-year-old son, Danny (Samuel Irons), in a vardo behind the filling station and garage where he works in the English countryside.
The land that the station and garage is built upon is coveted by businessman Victor Hazell (Robbie Coltrane), who owns the surrounding land and lives in a large mansion several miles away. He attempts to buy the Smiths' land, but William turns down his offers. Used to getting his own way, he begins a campaign of harassment, trying to force them off their land. Several inspectors from the local council come and assess William's property, and it becomes obvious that Hazell has sent them there by alerting them with false stories.
William decides to poach Hazell's prized game pheasants in retribution, using raisins to lure them out, but comes home empty handed; Danny had detected his absence and was relieved to see him return. Afterwards, he reveals that he was out poaching.
A while afterwards, William informs Danny that he will be going out poaching again at night. Danny wakes up during the night, detects his absence (he had promised to be back three hours before), and decides to go and look for him. He heads for the forest at the wheel of a vintage Austin Seven that William had been repairing, but on the way there he passes a police car, which turns around to pursue him after the officers realized that the car was being driven by an underage driver. He manages to shake them off by darting through a gap in the roadside hedges and driving along a country lane until he reaches the forest. He then spots two gamekeepers and hides from them, but then he hears them talking to someone in a deep hole in the ground; when they walk off to tell Hazell, Danny goes over and finds that the man in the hole is William, who had fallen into there and broken his ankle. He manages to help him out by using a rope tied to a tree, and they get away in the car just in time to avoid being caught by Hazell and his two armed gamekeepers, but he hears the car starting in the distance and gives chase, but they reach the road soon enough to spot the car and Hazell is convinced that it is them.
The local policeman, Sergeant Enoch Samways, later receives word from Hazell that William has been poaching on his land and goes over to question him. However, he deliberately falsifies the report in order to claim that William is innocent (his injury is due to "falling down the steps of his caravan"), owing to his dislike of Hazell and the fact that he himself is very much into poaching, despite his position of authority.
Meanwhile, Danny has started a new term at school, with a new schoolmaster, Captain Lancaster (Ronald Pickup), a strict disciplinarian who practices corporal punishment and detests lateness and cheating. He has already given Danny 1,000 lines as punishment for being late for school twice. When the headmaster, Mr. Snoddy (Lionel Jeffries), who is secretly rather fond of gin even during school hours, catches him caning Danny after another student whispered to him during class, he gives Lancaster a severe reprimand and tells him he will personally see that he is "out on his ear" if there is ever a repetition of his action; as he had made it clear to him on his appointment that corporal punishment was not permitted in the school.
Hazell announces a shooting event and invites several lords and other wealthy businessmen to come and hunt his pheasants, though several mistrust him. William and Danny decide to put a grand plan into action to poach all of his pheasants before the event, embarrassing him in front of the people he wanted to impress. Danny hits upon the idea of using sleeping pills, given to William by Doc Spencer (Cyril Cusack) for his broken ankle, to put the pheasants to sleep. They fill hundreds of raisins with ground-up pills in preparation. The next day, Captain Lancaster catches Danny sleeping in class and makes him run laps around the playground after school as a punishment. He escapes by climbing a wall, and Lancaster resigns out of sheer frustration, much to the delight of Mr. Snoddy.
Danny's plan goes off without a hitch; soon, the garage is filled with sleeping pheasants, whilst the villagers look on in amazement. Suddenly, Hazell and his shooting party arrive there, just as most of the pheasants start to wake up, and Hazell threatens to have Danny and William arrested for poaching and trespassing. Sgt. Samways arrives and, after being rudely insulted by Hazell, informs him and the crowd that no crimes have been committed; the law states that game-birds belong to the owner of the land they are on, which in this case is William. Angry and frustrated, Hazell drives off, amid jests from the locals, and loses the respect of his shooting party due to the lack of pheasants to shoot. Afterwards, a government official reveals to everyone why Hazell had really invited them: so he could unveil his grand plan of building a new town on the land he owns, which would wipe out the village. Without owning the Smiths' land, his plan can't go ahead. William, Danny, and the rest of the villagers celebrate this news and Danny, as an act of kindness, releases the pheasants and lets them fly away to pastures new.

Question: What was Danny caught doing in class?
Answer: sleeping