Section 94. If a person other than a railroad corporation is required by law or contract to erect or maintain fences along a part of the line of the railroad, the corporation shall erect such fences or keep them in repair as provided in the preceding section, and may recover in contract the reasonable cost thereof from such person. If he is an owner of land adjoining such line, the corporation shall also have a lien upon said land for labor performed and furnished and all materials furnished and used by it in erecting and repairing such fences upon such land, and for the costs which may arise in enforcing it; and it shall be enforced in the manner provided for enforcing liens for labor in chapter two hundred and fifty-four.