#!/usr/bin/env perl -w
# $Id: openbrowser 49039 2009-04-02 08:15:03Z ryandesign@macports.org $
#
# openbrowser by Ryan Schmidt
# MIT license
#
# openbrowser opens files and URLs into your default web browser (or
# just opens the browser, if you provide no arguments). Unlike "open",
# openbrowser will still open local .html files into your web browser
# even if you have configured LaunchServices to open .html files into
# e.g. a text editor.
#
# usage: openbrowser [ file | url ] [ ... ]
#
# Thanks to John Gruber for coincidentally posting the code I'd been
# seeking for reading the http helper from Internet Config.
# http://daringfireball.net/2009/02/do_shell_script_premature_optimization

use Mac::InternetConfig;

$browser = +(GetICHelper "http")[1];
@open_args = ("-a", $browser);
push @open_args, @ARGV;

exec "open", @open_args;
