Section 14. If the office of city clerk is vacant, or if a city clerk is unable to perform the duties required by chapters fifty to fifty-six, inclusive, the mayor shall appoint a temporary clerk to perform such duties. If at a town meeting the office of town clerk is vacant, or if the town clerk is absent, the meeting shall elect by ballot a temporary clerk. The selectmen, or in their absence three persons chosen at the meeting in such manner as the voters present shall determine, shall receive and count the votes and declare the election of such clerk. If in case of a vacancy other duties than those required of a town clerk at a town meeting are to be performed, or if he is unable to perform such duties, the selectmen may in writing under their hands appoint a clerk for the performance thereof, who shall be sworn and shall, in the performance of such duties, have the same powers and be subject to the same requirements and penalties as the town clerk, and he shall immediately make a record of his election or appointment. A temporary clerk appointed under this section shall not be required to be a resident nor a registered voter of the city or town.