line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Shell::Cap; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2020-03-10'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'Shell-Cap'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
68242
|
use strict 'vars', 'subs'; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
34
|
|
9
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
10
|
1
|
|
|
1
|
|
1705
|
use Log::ger; |
|
1
|
|
|
|
|
51
|
|
|
1
|
|
|
|
|
5
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
238
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
140
|
|
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
14
|
|
|
|
|
|
|
shell_supports_pipe |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub shell_supports_pipe { |
18
|
1
|
|
|
1
|
1
|
1768
|
require ShellQuote::Any::PERLANCAR; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
20
|
my $cmd = join( |
21
|
|
|
|
|
|
|
" ", |
22
|
|
|
|
|
|
|
ShellQuote::Any::PERLANCAR::shell_quote($^X), |
23
|
|
|
|
|
|
|
"-e", ShellQuote::Any::PERLANCAR::shell_quote("print 2"), |
24
|
|
|
|
|
|
|
"|", |
25
|
|
|
|
|
|
|
ShellQuote::Any::PERLANCAR::shell_quote($^X), |
26
|
|
|
|
|
|
|
"-e", ShellQuote::Any::PERLANCAR::shell_quote("print *3"), |
27
|
|
|
|
|
|
|
); |
28
|
1
|
|
|
|
|
1470
|
log_trace "Checking whether shell supports pipe with command $cmd"; |
29
|
1
|
50
|
|
|
|
6003
|
`$cmd` == 6 ? 1:0; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
# ABSTRACT: Probe shell's capabilities |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |