| blib/lib/IPC/Run/Fused.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % | 
| statement | 13 | 29 | 44.8 | 
| branch | 0 | 2 | 0.0 | 
| condition | n/a | ||
| subroutine | 5 | 8 | 62.5 | 
| pod | n/a | ||
| total | 18 | 39 | 46.1 | 
| line | stmt | bran | cond | sub | pod | time | code | 
|---|---|---|---|---|---|---|---|
| 1 | 307 | 307 | 5982769 | use 5.008003; | |||
| 307 | 918 | ||||||
| 2 | 307 | 307 | 1025 | use strict; | |||
| 307 | 409 | ||||||
| 307 | 5233 | ||||||
| 3 | 307 | 307 | 829 | use warnings; | |||
| 307 | 409 | ||||||
| 307 | 24033 | ||||||
| 4 | |||||||
| 5 | package IPC::Run::Fused; | ||||||
| 6 | |||||||
| 7 | our $VERSION = '1.000001'; | ||||||
| 8 | |||||||
| 9 | # ABSTRACT: Capture Stdout/Stderr simultaneously as if it were one stream, painlessly. | ||||||
| 10 | |||||||
| 11 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | ||||||
| 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 | our %FAIL_CONTEXT; | ||||||
| 116 | |||||||
| 117 | 307 | 307 | 2335 | use Exporter qw(import); | |||
| 307 | 408 | ||||||
| 307 | 111175 | ||||||
| 118 | sub run_fused; | ||||||
| 119 | our @EXPORT_OK = qw( run_fused _fail ); | ||||||
| 120 | |||||||
| 121 | sub _stringify { | ||||||
| 122 | 0 | 0 | 0 | my ($entry) = @_; | |||
| 123 | 0 | 0 | 0 | return 'undef' if not defined $entry; | |||
| 124 | 0 | 0 | return qq{`$entry`}; | ||||
| 125 | } | ||||||
| 126 | |||||||
| 127 | sub _fail { ## no critic (Subroutines::RequireArgUnpacking) | ||||||
| 128 | 0 | 0 | 0 | my (@message) = @_; | |||
| 129 | my $errors = { | ||||||
| 130 | ## no critic (ValuesAndExpressions::RequireInterpolationOfMetachars) | ||||||
| 131 | q[$?] => _stringify($?), | ||||||
| 132 | q[$!] => _stringify($!), | ||||||
| 133 | q[$^E] => _stringify($^E), | ||||||
| 134 | q[$@] => _stringify($@), | ||||||
| 135 | 0 | 0 | ( map { $_ => _stringify( $FAIL_CONTEXT{$_} ) } keys %FAIL_CONTEXT ), | ||||
| 0 | 0 | ||||||
| 136 | }; | ||||||
| 137 | 0 | 0 | my $message = q[]; | ||||
| 138 | 0 | 0 | $message .= qq{\n} . $_ for @message; | ||||
| 139 | 0 | 0 | $message .= sprintf qq{\n\t%s => %s}, $_, $errors->{$_} for sort keys %{$errors}; | ||||
| 0 | 0 | ||||||
| 140 | 0 | 0 | $message .= qq{\n}; | ||||
| 141 | 0 | 0 | require Carp; | ||||
| 142 | 0 | 0 | @_ = $message; | ||||
| 143 | 0 | 0 | goto \&Carp::confess; | ||||
| 144 | } | ||||||
| 145 | |||||||
| 146 | sub _win32_run_fused { | ||||||
| 147 | 0 | 0 | 0 | require IPC::Run::Fused::Win32; | |||
| 148 | 0 | 0 | goto \&IPC::Run::Fused::Win32::run_fused; | ||||
| 149 | } | ||||||
| 150 | |||||||
| 151 | sub _posix_run_fused { | ||||||
| 152 | 15450 | 15450 | 7096661051 | require IPC::Run::Fused::POSIX; | |||
| 153 | 15450 | 143372 | goto \&IPC::Run::Fused::POSIX::run_fused; | ||||
| 154 | } | ||||||
| 155 | |||||||
| 156 | if ( 'MSWin32' eq $^O ) { | ||||||
| 157 | *run_fused = \&_win32_run_fused; | ||||||
| 158 | } | ||||||
| 159 | else { | ||||||
| 160 | *run_fused = \&_posix_run_fused; | ||||||
| 161 | } | ||||||
| 162 | 1; | ||||||
| 163 | |||||||
| 164 | __END__ |