
282 So.2d 614 (1973)
Frank POLK, Plaintiff-Appellant,
v.
Elayn HUNT, Director, Department of Corrections, et al., Defendant-Appellee.
No. 9432.
Court of Appeal of Louisiana, First Circuit.
June 29, 1973.
Frank Polk, in pro. per.
S. J. Dileo, Jr., Dept. of Corrections, Baton Rouge, for defendant-appellee.
Before SARTAIN, BLANCHE and WATSON, JJ.
SARTAIN, Judge.
Plaintiff-appellant is currently incarcerated in the Louisiana State Penitentiary at Angola. He filed a petition in the 19th Judicial District Court, in proper person, which petition is entitled:

"MOTION TO PROCEED IN FORMA PAUPERIS

MOTION FOR APPOINTMENT OF COUNSEL AND PETITION FOR WRIT OF MANDAMUS"
The petition itself alleges that appellant was subjected to cruel and unusual punishment *615 and to frivolous and arbitrary disciplinary reports. However, his principal complaint is directed against Messrs. C. Baudin and F. W. Spears, security officers at the penitentiary. Appellant contends that on or about June 24, 1972, when he was placed in solitary confinement, he was struck by Officer Baudin and cursed by this officer together with Officer Spears.
The prayer in the petition is quoted herewith in its entirety:
"Wherefore, petitioner prays that this Honorable court issue forthwith a writ of mandamus directed to the respondents, therein enjoining them from imposing such treatment and/or punishment as that described herein upon any prisoner in the Louisiana State Penitentiary at Angola, Louisiana; petitioner prays further that the following named inmates: Hubert Breda 70811; J. Gremillion 67680; and William Brooks be ordered and/or summoned to appear at the hearing on this cause to give oral testimony in open court with reference to the petitioner's petition for a writ of mandamus. Petitioner prays further for all necessary orders."
(Emphasis ours)
The trial judge issued an order for a hearing to be held on July 27, 1972, at 9:00 o'clock A.M.
The defendants were represented by the Attorney General's Office. Officers Baudin and Spears were called to testify and categorically denied the accusations contained in appellant's petition.
The petitioner was not accorded the opportunity to be present nor were the persons he designated subpoenaed to testify on his behalf. On this date the matter was submitted and the trial judge denied the write. Oral or written reasons were not assigned.
In his brief on appeal appellant contends that the trial judge erred in not allowing petitioner to be present, thus denying him the opportunity to cross-examine the witnesses called against him, and to call the witnesses he requested be subpoenaed to give "defensive evidence in his favor". Appellant further contends that the trial judge erred in failing to issue a writ of mandamus.
It is apparent to us from a reading of the record and the briefs filed by the defendants that this matter was treated strictly as one for a writ of mandamus. There is no question in our minds but that the denial of a writ of mandamus under these circumstances would be proper for the reason that mandamus cannot be used to require an official to perform a purely discretionary act. State ex rel. Hayes v. Louisiana State Board of Barber Examiners, 1968, La.App., 208 So.2d 369, writ denied 252 La. 169, 210 So.2d 53. However, we are persuaded to treat appellant's petition as one for a permanent injunction and/or mandatory injunction. It is evident to us that the prayer of appellant's petition clearly indicates that this is the remedy sought. It is understandable how appellant erroneously entitled his petition as one for a writ of mandamus. Nonetheless, we are constrained to hold that appellant's petition should have been viewed as an application for a permanent injunction. Moreover, appellant should have been given an opportunity to be present and the witnesses he requested should have been subpoenaed.
In the recent case of Budget Plan of Baton Rouge, Inc. v. Talbert, La., 276 So.2d 297, the Supreme Court reiterated the proposition that pleadings should be taken for what they seek and not be restricted to the label placed upon them. In the cited case the court held:
"Except as provided in Article 1703, a final judgment shall grant the relief to which the party in whose favor it is rendered is entitled, even if the party has not demanded such relief in his pleadings and the latter contain no prayer for general and equitable relief. (La. Code Civil P. art. 662).

*616 * * * * * *
"Every pleading shall be so construed as to do substantial justice. (Ibid. art. 865).
* * * * * *
"The appellate court shall render any judgment which is just, legal, and proper upon the record on appeal... (Ibid. art. 2164).
* * * * * *
"The articles of this Code are to be construed liberally, and with due regard for the fact that rules of procedure implement the substantive law and are not an end in themselves. (Ibid. art. 5051).
"Technical objections and harsh rules of pleading are not favored in our courts. Pleadings should be liberally construed, relaxing the technical rules in order to arrive at the truth, afford a litigant his day in court, and avoid a miscarriage of justice. Succession of Smith, 247 La. 921, 175 So.2d 269 (1965); Breaux v. Laird, 230 La. 221, 88 So.2d 33 (1956); West v. Ray, 210 La. 25, 26 So.2d 221 (1946)." (276 So.2d 297, 302)
While Talbert dealt primarily with "fact pleadings", the rationale of the decision relative to the construction given to the pleadings themselves is applicable here.
For these reasons, appellant's petition should be construed as one for a permanent injunction against the officers named. Inasmuch as appellant did not seek a restraining order or a rule for a preliminary injunction, this matter should proceed via ordinary and be heard on the merits.
Accordingly, the judgment of the District Court is reversed and set aside and this matter is remanded for further proceedings in accordance with the views herein expressed.
Reversed and remanded.
