.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Browser::Open 3pm" .TH Browser::Open 3pm "2021-01-03" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Browser::Open \- open a browser in a given URL .SH "VERSION" .IX Header "VERSION" version 0.03 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Browser::Open qw( open_browser ); \& \& ### Try commands specific to the current Operating System \& my $ok = open_browser($url); \& # ! defined($ok): no recognized command found \& # $ok == 0: command found and executed \& # $ok != 0: command found, error while executing \& \& ### Try all known commands \& my $ok = open_browser($url, 1); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The functions optionaly exported by this module allows you to open URLs in the user browser. .PP A set of known commands per OS-name is tested for presence, and the first one found is executed. With an optional parameter, all known commands are checked. .PP The \*(L"open_browser\*(R" uses the \f(CW\*(C`system()\*(C'\fR function to execute the command. If you want more control, you can get the command with the \&\*(L"open_browser_cmd\*(R" or \*(L"open_browser_cmd_all\*(R" functions and then use whatever method you want to execute it. .SH "API" .IX Header "API" All functions are \fBnot\fR exported by default. You must ask for them explicitly. .SS "open_browser" .IX Subsection "open_browser" .Vb 1 \& my $ok = open_browser($url, $all); .Ve .PP Find an appropriate command and executes it with your \f(CW$url\fR. If \&\f(CW$all\fR is false, the default, only commands that match the current \s-1OS\s0 will be tested. If true, all known commands will be tested. .PP If no command was found, returns \f(CW\*(C`undef\*(C'\fR. .PP If a command is found, returns the exit code of the execution attempt, 0 for success. See the \f(CW\*(C`system()\*(C'\fR for more information about this exit code. .PP If no \f(CW$url\fR is given, an exception will be thrown: \&\f(CW\*(C`Missing required parameter $url\*(C'\fR. .SS "open_browser_cmd" .IX Subsection "open_browser_cmd" .Vb 1 \& my $cmd = open_browser_cmd(); .Ve .PP Returns the best command found to open a \s-1URL\s0 on your system. .PP If no command was found, returns \f(CW\*(C`undef\*(C'\fR. .SS "open_browser_cmd_all" .IX Subsection "open_browser_cmd_all" .Vb 1 \& my $cmd = open_browser_cmd_all(); .Ve .PP Returns the first command found to open a \s-1URL.\s0 .PP If no command was found, returns \f(CW\*(C`undef\*(C'\fR. .SH "AUTHOR" .IX Header "AUTHOR" Pedro Melo, \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2009 Pedro Melo. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.