In May 1805, during the Napoleonic Wars, Captain Jack Aubrey of HMS Surprise is ordered to pursue the French privateer Acheron, and "Sink, Burn or take her [as] a Prize." The British warship is ambushed by Acheron; Surprise is heavily damaged, while its own cannon fire does not penetrate the enemy ship's hull. Using smaller boats, the crew of Surprise tow the ship into a fog bank and evade pursuit. Meanwhile, Aubrey learns from a crewman who saw Acheron being built that it is heavier and faster than Surprise, and the senior officers consider the ship out of their class. Aubrey notes that such a ship could tip the balance of power in Napoleon's favour if allowed to plunder the British whaling fleet at will. He orders pursuit of Acheron, rather than returning to port for repairs. Acheron again ambushes Surprise, but Aubrey slips away in the night by using a clever decoy buoy and ships lamps.
Following the privateer south, Surprise rounds Cape Horn and heads to the Galapagos Islands, where Aubrey is sure Acheron will prey on Britain's whaling fleet. The ship's doctor, Maturin, is interested in the islands' flora and fauna, and Aubrey promises his friend several days' exploration time. When Surprise reaches the Galapagos they recover the survivors of a whaling ship destroyed by Acheron. Realizing the ship is close, Aubrey hastily pursues the privateer. Maturin feels that Aubrey is going back on his word, and is following Acheron more out of pride than duty.
Marine officer Captain Howard attempts to shoot an albatross, but accidentally hits Maturin. The surgeon's mate informs Aubrey that the bullet and a piece of cloth it took with it must be removed, but the operation should be performed on solid ground. Despite closing on Acheron, Aubrey turns around and takes the doctor back to the Galapagos. Maturin performs surgery on himself using a mirror. Giving up the pursuit of the privateer, Aubrey grants Maturin the chance to explore the island and gather specimens before they head for home. On crossing the island looking for a species of flightless cormorant, the doctor discovers Acheron anchored on the other side of the island. Abandoning most of his specimens, Maturin warns Aubrey, and Surprise readies for battle. Due to Acheron's sturdy hull, Surprise must get in close to deal damage. After observing the camouflage ability of one of Maturin's specimens—a stick insect—Aubrey disguises Surprise as a whaling ship; he hopes the French would move close to capture the valuable ship rather than destroy it. The Acheron falls for the disguise and is disabled. Aubrey leads boarding parties across the wreckage, engaging in fierce hand-to-hand combat before the ship is captured. Looking for the Acheron's captain, Aubrey is directed to the sickbay, where a French doctor tells him the captain is dead and offers Aubrey the commander's sword.
Acheron and Surprise are repaired; while Surprise will remain in the Galapagos, the captured Acheron is to be taken to Valparaíso. As Acheron sails away, Maturin mentions that their doctor had died months ago. Realising the French captain deceived him by pretending to be the ship's doctor, Aubrey gives the order to change course to intercept the Acheron and escort her to Valparaíso, and for the crew to assume battle stations. Maturin is again denied the chance to explore the Galapagos, but Aubrey wryly notes that since the bird he seeks is flightless, "it's not going anywhere", and the two play a selection of Luigi Boccherini as the crew assumes battle stations and the Surprise turns in pursuit of the Acheron.

Question: How does the doctor perform surgery on himself?
Answer: By using a mirror