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

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"); }

Replies are listed 'Best First'.
Re^9: HTML::Display help needed
by jethro (Monsignor) on Aug 22, 2008 at 14:18 UTC

    Strange, it is exactly how I read the documentation. What sentence do you think contradicts my interpretation? It might help Corion improve the documentation

    I tried your code (with my firefox command on linux) and it worked like a charm. Which points to your "run ..." call that might not be right. Have you tried the following on your command shell?

    run "C:\Program Files\Mozilla Firefox\firefox.exe" www.google.com

    Does it work? If not, why should the script work. If yes, try some variations. Delete the "" or put the "" around C:....firefox.exe and %s. Remove the run command (which looks useless to me, but I don't know windows).

      First the documentation, which says:

      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.

      That originally sounded to me like the variable should be set to "http://www.whatever.com" and it conflicted with the implication of the variable name. Now that I understand how it is supposed to work it makes perfect sense. I've done a lot of technical writing in my career and the the biggest challenge is writing something for someone that doesn't have the understanding of the writer. How about this:

      If there is no specialized class yet, but your browser can be controlled via the command line, then setting PERL_HTML_DISPLAY_COMMAND will cause HTML::Display to use a system() call. Set the variable to the path of the browser command, to launch the browser. To load the temp file generated by HTML::Display, append whitespace and '%s' to the PERL_HTML_DISPLAY_COMMAND string.

      Example (Cygwin):

      $ENV{'PERL_HTML_DISPLAY_COMMAND'}='run "C:\Program Files\Mozilla Firefox\firefox.exe" %s';

      Examples are my best friend. However, you might want to use a Unix command line rather then Cygwin as the 'run' might confuse the reader. Now on to my problem:

      IE will not launch even that way for some reason. It appears to try to load it but no joy. Firefox does seem to work so while that gives me something to work with (I'll have to play with the quotes, spaces in path names are a headache), I still need to figure out what the deal is with IE. It seems like more of a Cygwin problem then a perl problem at this point.

      Thanks.
        Progress! Although IE will not launch from the command line, it turns out there is a class for it. Setting:

        $ENV{'PERL_HTML_DISPLAY_CLASS'}='HTML::Display::Win32::IE';

        does work but requires Win32::OLE be installed. At this point I am not planning to pursue Firefox but I do need to solve some platform dependence issues eventually.