line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Env::Browser; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
4
|
3
|
|
|
3
|
|
50557
|
use base qw(Exporter); |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
465
|
|
5
|
3
|
|
|
3
|
|
24
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
96
|
|
6
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
121
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Modules. |
9
|
3
|
|
|
3
|
|
4090
|
use Readonly; |
|
3
|
|
|
|
|
10755
|
|
|
3
|
|
|
|
|
666
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Constants. |
12
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(run); |
13
|
|
|
|
|
|
|
Readonly::Scalar our $SPACE => q{ }; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Version. |
16
|
|
|
|
|
|
|
our $VERSION = 0.05; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Run browser. |
19
|
|
|
|
|
|
|
sub run { |
20
|
5
|
|
|
5
|
1
|
13018
|
my $uri = shift; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Environment $BROWSER variable. |
23
|
5
|
|
|
|
|
19
|
my $browser_string = $ENV{'BROWSER'}; |
24
|
5
|
100
|
|
|
|
24
|
if (! $browser_string) { |
25
|
1
|
|
|
|
|
9
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Split variables. |
29
|
4
|
|
|
|
|
24
|
my @browser = split m/:/ms, $browser_string; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Run. |
32
|
4
|
|
|
|
|
17
|
while (my $browser = shift @browser) { |
33
|
6
|
100
|
|
|
|
42
|
if ($browser =~ m/%s/ms) { |
34
|
2
|
|
|
|
|
22
|
$browser = sprintf $browser, $uri; |
35
|
|
|
|
|
|
|
} else { |
36
|
4
|
|
|
|
|
24
|
$browser .= $SPACE.$uri; |
37
|
|
|
|
|
|
|
} |
38
|
6
|
100
|
|
|
|
143770
|
if ((system $browser) == 0) { |
39
|
4
|
|
|
|
|
48
|
last; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
117
|
return; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |