This file is indexed.

/usr/share/perl5/Browser/Open.pm is in libbrowser-open-perl 0.04-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
package Browser::Open;
our $VERSION = '0.04';



use strict;
use warnings;
use Carp;
use File::Spec::Functions qw( catfile );

use parent 'Exporter';

@Browser::Open::EXPORT_OK = qw(
  open_browser
  open_browser_cmd
  open_browser_cmd_all
);

my @known_commands = (
  ['', $ENV{BROWSER}],
  ['darwin',  '/usr/bin/open', 1],
  ['cygwin',  'start'],
  ['MSWin32', 'start', undef, 1],
  ['solaris', 'xdg-open'],
  ['solaris', 'firefox'],
  ['linux',   'sensible-browser'],
  ['linux',   'xdg-open'],
  ['linux',   'x-www-browser'],
  ['linux',   'www-browser'],
  ['linux',   'htmlview'],
  ['linux',   'gnome-open'],
  ['linux',   'gnome-moz-remote'],
  ['linux',   'kfmclient'],
  ['linux',   'exo-open'],
  ['linux',   'firefox'],
  ['linux',   'seamonkey'],
  ['linux',   'opera'],
  ['linux',   'mozilla'],
  ['linux',   'iceweasel'],
  ['linux',   'netscape'],
  ['linux',   'galeon'],
  ['linux',   'opera'],
  ['linux',   'w3m'],
  ['linux',   'lynx'],
  ['freebsd', 'xdg-open'],
  ['freebsd', 'gnome-open'],
  ['freebsd', 'gnome-moz-remote'],
  ['freebsd', 'kfmclient'],
  ['freebsd', 'exo-open'],
  ['freebsd', 'firefox'],
  ['freebsd', 'seamonkey'],
  ['freebsd', 'opera'],
  ['freebsd', 'mozilla'],
  ['freebsd', 'netscape'],
  ['freebsd', 'galeon'],
  ['freebsd', 'opera'],
  ['freebsd', 'w3m'],
  ['freebsd', 'lynx'],
  ['',        'open'],
  ['',        'start'],
);

##################################

sub open_browser {
  my ($url, $all) = @_;
  croak('Missing required parameter $url, ') unless $url;

  my $cmd = $all ? open_browser_cmd_all() : open_browser_cmd();
  return unless $cmd;

  return system($cmd, $url);
}

sub open_browser_cmd {
  return _check_all_cmds($^O);
}

sub open_browser_cmd_all {
  return _check_all_cmds('');
}


##################################

sub _check_all_cmds {
  my ($filter) = @_;

  foreach my $spec (@known_commands) {
    my ($osname, $cmd, $exact, $no_search) = @$spec;
    next unless $cmd;
    next if $osname && $filter && $osname ne $filter;
    next if $no_search && !$filter && $osname ne $^O;

    return $cmd if $exact && -x $cmd;
    return $cmd if $no_search;
    $cmd = _search_in_path($cmd);
    return $cmd if $cmd;
  }
  return;
}

sub _search_in_path {
  my $cmd = shift;

  for my $path (split(/:/, $ENV{PATH})) {
    next unless $path;
    my $file = catfile($path, $cmd);
    return $file if -x $file;
  }
  return;
}


1;
__END__

=head1 NAME

Browser::Open - open a browser in a given URL


=head1 VERSION

version 0.03

=head1 SYNOPSIS

    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);


=head1 DESCRIPTION

The functions optionaly exported by this module allows you to open URLs
in the user browser.

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.

The L<"open_browser"> uses the C<system()> function to execute the
command. If you want more control, you can get the command with the
L<"open_browser_cmd"> or L<"open_browser_cmd_all"> functions and then
use whatever method you want to execute it.


=head1 API

All functions are B<not> exported by default. You must ask for them
explicitly.


=head2 open_browser

    my $ok = open_browser($url, $all);

Find an appropriate command and executes it with your C<$url>. If
C<$all> is false, the default, only commands that match the current OS
will be tested. If true, all known commands will be tested.

If no command was found, returns C<undef>.

If a command is found, returns the exit code of the execution attempt, 0
for success. See the C<system()> for more information about this
exit code.

If no C<$url> is given, an exception will be thrown:
C<< Missing required parameter $url >>.


=head2 open_browser_cmd

    my $cmd = open_browser_cmd();

Returns the best command found to open a URL on your system.

If no command was found, returns C<undef>.


=head2 open_browser_cmd_all

    my $cmd = open_browser_cmd_all();

Returns the first command found to open a URL.

If no command was found, returns C<undef>.


=head1 AUTHOR

Pedro Melo, C<< <melo at cpan.org> >>


=head1 COPYRIGHT & LICENSE

Copyright 2009 Pedro Melo.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=cut