1Browser::Open(3) User Contributed Perl Documentation Browser::Open(3)
2
3
4
6 Browser::Open - open a browser in a given URL
7
9 version 0.03
10
12 use Browser::Open qw( open_browser );
13
14 ### Try commands specific to the current Operating System
15 my $ok = open_browser($url);
16 # ! defined($ok): no recognized command found
17 # $ok == 0: command found and executed
18 # $ok != 0: command found, error while executing
19
20 ### Try all known commands
21 my $ok = open_browser($url, 1);
22
24 The functions optionaly exported by this module allows you to open URLs
25 in the user browser.
26
27 A set of known commands per OS-name is tested for presence, and the
28 first one found is executed. With an optional parameter, all known
29 commands are checked.
30
31 The "open_browser" uses the "system()" function to execute the command.
32 If you want more control, you can get the command with the
33 "open_browser_cmd" or "open_browser_cmd_all" functions and then use
34 whatever method you want to execute it.
35
37 All functions are not exported by default. You must ask for them
38 explicitly.
39
40 open_browser
41 my $ok = open_browser($url, $all);
42
43 Find an appropriate command and executes it with your $url. If $all is
44 false, the default, only commands that match the current OS will be
45 tested. If true, all known commands will be tested.
46
47 If no command was found, returns "undef".
48
49 If a command is found, returns the exit code of the execution attempt,
50 0 for success. See the "system()" for more information about this exit
51 code.
52
53 If no $url is given, an exception will be thrown: "Missing required
54 parameter $url".
55
56 open_browser_cmd
57 my $cmd = open_browser_cmd();
58
59 Returns the best command found to open a URL on your system.
60
61 If no command was found, returns "undef".
62
63 open_browser_cmd_all
64 my $cmd = open_browser_cmd_all();
65
66 Returns the first command found to open a URL.
67
68 If no command was found, returns "undef".
69
71 Pedro Melo, "<melo at cpan.org>"
72
74 Copyright 2009 Pedro Melo.
75
76 This program is free software; you can redistribute it and/or modify it
77 under the same terms as Perl itself.
78
79
80
81perl v5.16.3 2012-03-09 Browser::Open(3)