Any person who may be able to labor and who has no apparent means of subsistence, and neglects to apply himself to some honest occupation for the support of himself and family, or if any person shall be found spending his time in dissipation or gaming, or sauntering about without employment, or endeavoring to maintain himself or his family by any undue or unlawful means, such person shall be deemed a vagrant and guilty of a misdemeanor and punished by a fine not to exceed fifty dollars or by imprisonment not to exceed thirty days, and the offense shall be cognizable before the mayor of said town, who may release the party on his giving a recognizance, with security, for his industrious and peaceable deportment for one year or less from the date thereof, or may also impose on him a punishment not to exceed that above mentioned. And the said mayor may cause such person or persons to be farmed out to work the public streets or other public work of said town as set out in section fourteen of this act.