File Coverage

blib/lib/Shell/Cap.pm
Criterion Covered Total %
statement 12 12 100.0
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 18 19 94.7


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.001'; # VERSION
7              
8 1     1   70140 use strict 'vars', 'subs';
  1         11  
  1         37  
9 1     1   5 use warnings;
  1         1  
  1         29  
10              
11 1     1   4 use Exporter qw(import);
  1         2  
  1         153  
12             our @EXPORT_OK = qw(
13             shell_supports_pipe
14             );
15              
16             sub shell_supports_pipe {
17 1     1 1 1808 require ShellQuote::Any::PERLANCAR;
18              
19 1         20 my $cmd = join(
20             " ",
21             ShellQuote::Any::PERLANCAR::shell_quote($^X),
22             "-e", ShellQuote::Any::PERLANCAR::shell_quote("print 2"),
23             "|",
24             ShellQuote::Any::PERLANCAR::shell_quote($^X),
25             "-e", ShellQuote::Any::PERLANCAR::shell_quote("print *3"),
26             );
27 1 50       9448 `$cmd` == 6 ? 1:0;
28             }
29              
30             1;
31             # ABSTRACT: Probe shell's capabilities
32              
33             __END__