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

I have a Tk app and I'm trying to launch the local Browser on Linux/Solaris for the help files. I'm using the following snippet but it isn't that effieicent because it doesn't detect non usr/bin installs.
sub start_html { my @browsers = qw(firefox mozilla netscape galeon konqueror); foreach (@browsers) { if (-f "\/usr\/bin\/$_") { system ("$_ $installpath\/help\/HelpFile.htm"); last; } } }
Does anyone have any ideas how I could make this more flexible. I could obviously look in /usr/local/bin, /usr, or /firefox , /mozilla, etc. but this seems crazy.

Thanks

Replies are listed 'Best First'.
Re: Locating browser location?
by JediWizard (Deacon) on Feb 28, 2006 at 15:03 UTC

    You could try looking in every directory under $ENV{PATH}. Might not be perfect, but it may add some flexabilty.


    They say that time changes things, but you actually have to change them yourself.

    —Andy Warhol

Re: Locating browser location?
by explorer (Chaplain) on Feb 28, 2006 at 16:04 UTC
    If the PATH environment var is right set, run your program without the if() test.
Re: Locating browser location?
by Anonymous Monk on Feb 28, 2006 at 21:30 UTC
Re: Locating browser location?
by Ultra (Hermit) on Mar 01, 2006 at 09:18 UTC

    And also maybe it is useful to let the user tell you where's the browser he/she wants to use.

    Dodge This!