| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Selenium::CanStartBinary::FindBinary; |
|
2
|
|
|
|
|
|
|
$Selenium::CanStartBinary::FindBinary::VERSION = '1.48'; |
|
3
|
1
|
|
|
1
|
|
8
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
28
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
26
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Coercions for finding webdriver binaries on your system |
|
7
|
1
|
|
|
1
|
|
5
|
use Cwd qw/abs_path/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
48
|
|
|
8
|
1
|
|
|
1
|
|
480
|
use File::Which qw/which/; |
|
|
1
|
|
|
|
|
1061
|
|
|
|
1
|
|
|
|
|
59
|
|
|
9
|
1
|
|
|
1
|
|
501
|
use IO::Socket::INET; |
|
|
1
|
|
|
|
|
21956
|
|
|
|
1
|
|
|
|
|
10
|
|
|
10
|
1
|
|
|
1
|
|
987
|
use Selenium::Firefox::Binary qw/firefox_path/; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
122
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter; |
|
13
|
|
|
|
|
|
|
our @ISA = qw/Exporter/; |
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw/coerce_simple_binary coerce_firefox_binary/; |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
6
|
use constant IS_WIN => $^O eq 'MSWin32'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
333
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub coerce_simple_binary { |
|
20
|
0
|
|
|
0
|
0
|
|
my ($executable) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $manual_binary = _validate_manual_binary($executable); |
|
23
|
0
|
0
|
|
|
|
|
if ($manual_binary) { |
|
24
|
0
|
|
|
|
|
|
return $manual_binary; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
else { |
|
27
|
0
|
|
|
|
|
|
return _naive_find_binary($executable); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub coerce_firefox_binary { |
|
32
|
0
|
|
|
0
|
0
|
|
my ($executable) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $manual_binary = _validate_manual_binary($executable); |
|
35
|
0
|
0
|
|
|
|
|
if ($manual_binary) { |
|
36
|
0
|
|
|
|
|
|
return $manual_binary; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
else { |
|
39
|
0
|
|
|
|
|
|
return firefox_path(); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _validate_manual_binary { |
|
44
|
0
|
|
|
0
|
|
|
my ($executable) = @_; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $abs_executable = eval { |
|
47
|
0
|
|
|
|
|
|
my $path = abs_path($executable); |
|
48
|
0
|
0
|
0
|
|
|
|
die if $path && !-f $path; |
|
49
|
0
|
|
|
|
|
|
$path; |
|
50
|
|
|
|
|
|
|
}; |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if ($abs_executable) { |
|
53
|
0
|
0
|
0
|
|
|
|
if ( -x $abs_executable || IS_WIN ) { |
|
54
|
0
|
|
|
|
|
|
return $abs_executable; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
else { |
|
57
|
0
|
|
|
|
|
|
die 'The binary at ' |
|
58
|
|
|
|
|
|
|
. $executable |
|
59
|
|
|
|
|
|
|
. ' is not executable. Choose the correct file or chmod +x it as needed.'; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _naive_find_binary { |
|
65
|
0
|
|
|
0
|
|
|
my ($executable) = @_; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $naive_binary = which($executable); |
|
68
|
0
|
0
|
|
|
|
|
if ( defined $naive_binary ) { |
|
69
|
0
|
|
|
|
|
|
return $naive_binary; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
else { |
|
72
|
0
|
|
|
|
|
|
warn qq(Unable to find the $executable binary in your \$PATH.); |
|
73
|
0
|
|
|
|
|
|
return; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |