Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Locating browser location?

by Anonymous Monk
on Feb 28, 2006 at 14:56 UTC ( [id://533361]=perlquestion: print w/replies, xml ) Need Help??

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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://533361]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found