Section 22. Before trial, with the consent of the defendant, or after entry of a plea of guilty or nolo contendere, or after conviction, the court may make for the benefit of such destitute parent orders similar to those provided by section five; and the practice established by the first ten sections of this chapter shall, so far as applicable, apply to proceedings under this and the two preceding sections.