Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am constructing an HTML file by directing a program's output. Following the completion of the program, I would like to display the HTML.

system("perl ./c1.pl > ./c1/html");

This works fine but I have not been able to show the constructed file from the program

Replies are listed 'Best First'.
Re: display html file from Perl
by Corion (Patriarch) on Jul 07, 2017 at 21:23 UTC

    I wrote HTML::Display, which tries to do most of what I think you want, take some string in Perl and display it in a browser as HTML.

Re: display html file from Perl
by LanX (Saint) on Jul 07, 2017 at 19:39 UTC
    Well not really a Perl question ...

    ... you have to tell a browser to open the file.

    Like firefox PATH/c1.html

    not sure if Firefox still supports the -remote flag.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      use strict; use warnings; system("perl ./c1.pl > ./c1.html"); system("/usr/bin/firefox http://localhost:8080/ ./c1.html");

      This constructs the HTML file but Firefox returns:

      Error: GDK_BACKEND does not match available displays
        This  http://localhost:8080/ ./c1.html looks suspicious. At least the space, and did you really configure your local webserver to know the current working directory of your Perl script?

        I normally use the file:// protocol (+ absolute path) for simpler HTML pages (your title says "file" not application)

        If this doesn't help, fix your Firefox.

        edit

        To be clear this is NOT a Perl problem. Find a solution from the command line.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Re: display html file from Perl
by Anonymous Monk on Jul 07, 2017 at 19:25 UTC
    I do see that IN THIS POST, I have a typo in the name of the html file...this is not the case in the actual code.

      What is your problem: Do you

      • ... want to output the HTML from the file to the terminal?
      • ... want to show a web page in a browser window?
      • Or is it something else?

      Cheers, Sören

      Créateur des bugs mobiles - let loose once, run everywhere.
      (hooked on the Perl Programming language)

        having constructed the HTMLfile, I want to display it via a Perl script programatically/automatically. The HTML file has a series of input forms; it is interactive as opposed to static.