Section 4. If it appears to a court of record that a party or a witness who has been legally sworn and examined, or has made an affidavit, in any proceeding in a court or course of justice has so testified as to create a reasonable presumption that he has committed perjury therein, the court may forthwith commit him or may require him to recognize with sureties for his appearance to answer to an indictment for perjury; and thereupon the witnesses to establish such perjury may, if present, be bound over to the superior court, and notice of the proceedings shall forthwith be given to the district attorney.