A few comments on the above replies:
A boom brake is a good investment, but rigging a preventer will cost you nothing, as you will no doubt have spare lines available on your boat.
A preventer works best when rigged from a fore cleat rather than a centre cleat.
A preventer must always be rigged to the end of the boom, (a) , for maximum leverage at the optimum angle, and (b), fixing it to the centre of the boom can cause that spar to break in certain circumstances. (This advice is given at practically every pre-ARC talk or tutorial).
To guard against your preventer being overwhelmed due to stretch, good tension should be applied, preferably by taking your line through a block at the fore cleat and back to the cockpit where it can be tensioned,(carefully) on a winch.
If frequent gybes are envisaged, preventers should be rigged on both sides, so as to minimise the necessity for crew to leave the cockpit.
For drama-free gybes, Hamish’s method is by far the most preferable, as, when the mainsail is centred, it is “feathering” the wind, drawing from neither side. However, you must ensure that the mainsheet is not cleated and is not coiled, or in any condition where it might kink and get caught and not pay out smoothly as the wind catches the sail on the new windward side. The friction in the mainsheet system as it pays out helps to brake the boom as it swings out.