adamconkey
adamconkey

Reputation: 4745

perl - Launch url in browser opening in non-default browser

I try to launch my default browser and open to a specified URL as suggested here using something like:

use Browser::Open qw( open_browser );

my $url = 'http://www.google.com/';
open_browser($url);

But it opens it in Firefox even though Chromium is set to my default browser:

enter image description here

How do I get it to open in Chromium?

Upvotes: 2

Views: 339

Answers (1)

Amadan
Amadan

Reputation: 198436

Perl has no concept of default browser. As you can see in its documentation, Browser::Open will go down the list of known browser invocation commands and use the first one that works. Firefox apparently happens to be higher on the list than Chromium.

If you want to invoke Chromium, then just invoke Chromium yourself. Something like this should do:

system("chromium \"$url\"")

(you might have to change the name of the executable, depending on your system and PATH)

Upvotes: 4

Related Questions