ActiveState::Browser - Interface to invoke the web-browser


ActiveState::Browser - Interface to invoke the web-browser


  use ActiveState::Browser;


The ActiveState::Browser module provides an interface to make a web browser pop up showing some URL or file. The following functions are provided:

open( $url )

This will try to open up a web browser displaying the given URL. The function will croak if the $url can't be resolved or if no suitable browser could be found. The can_open() test can be used to protect against such failure, but note that such a test is not race-proof.

If the $url is absolute it is passed directly to the browser.

If the $url is relative it is looked up relative to the directory $ActiveState::Browser::HTML_DIR, which defaults to the current directory.

can_open( $url )

Will return TRUE if we can invoke a browser for the given URL. If the URL is not to a local file, then this always returns TRUE, given that a browser program was found.


The AS_BROWSER environment variable can be set to override what browser to use. The string %s will be replaced with the URL to open. If no %s is present the string is taken as a command to invoke with the URL as the only argument.

The %s template was inspired by the BROWSER environment variable suggestion that appear quite dead; see Note that the AS_BROWSER is not a colon separated list.