No person compelled to testify in any proceedings under section thirty shall be liable to criminal prosecution for any matters or causes in respect of which he shall be examined or to which his testimony shall relate, except to prosecution for perjury committed in such testimony.
Mass. Gen. Laws ch. 55, § 31