in reply to Re^4: HTML::Display help needed
in thread HTML::Display help needed

Have you seen the PERL_HTML_DISPLAY_COMMAND documentation? It allows you to specify the browser to be launched.

Replies are listed 'Best First'.
Re^6: HTML::Display help needed
by gw1500se (Beadle) on Aug 21, 2008 at 22:55 UTC
    I saw this:

    If there is no specialized class yet, but your browser can be controlled via the command line, then setting PERL_HTML_DISPLAY_COMMAND to the string to navigate to the URL will make HTML::Display use a system() call to the string. A %s in the value will be replaced with the name of the temporary file containing the HTML to display.

    I don't understand it. Is it trying to say I should launch the browser from command line, then use PERL_HTML_DISPLAY_COMMAND as a scalar to pass the string? What do I pass to '$browser->display'?

      Lets say you have a browser /usr/bin/firefox on your machine and you can start firefox simply with an URL as parameter like this:  /usr/bin/firefox http://www.google.com would start firefox with google displayed.

      Then you can set the environment variable PERL_HTML_DISPLAY_COMMAND to '/usr/bin/firefox %s' and otherwise leave your script unchanged.

      That's it. Run your script. It will automatically call firefox and substitute %s with the name of a temporary file it just generated

        Thanks for the reply. That moves the ball ahead a little, although that seems different then what the documentation describes. Anyway, IE will not load and I get an error saying pretty much that. Interestingly, Firefox does indeed load but only brings up the home page not the temp file. Here is the code I have now:
        $ENV{'PERL_HTML_DISPLAY_COMMAND'}='run "C:\Program Files\Mozilla Firef +ox\firefox.exe" %s'; my $browser=HTML::Display->new(); if (defined($browser)) { my $mypage="<html><body><h1>Hello world!</h1></body></html>"; $browser->display(html=>$mypage); } else { print("Unable to open browser: $@\n"); }