lib/Chj/Unix/Exitcode.pm

filter: Statementstmt 64.2% 27 / 42 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 0.0% 0 / 1 totaltotal 57.6% 34 / 59 CC 4 SCAR 14.8
CC
4
Cov
56%
as_string
12.0
exitcode
6.0
new
2.0
CRAP 4.4
« lib/FP/Repl/StackPlus.pm ↑ Summary lib/FP/Weak.pm »
1 #
2 # Copyright (c) 2007-2020 Christian Jaeger, copying@christianjaeger.ch
3 #
4 # This is free software, offered under either the same terms as perl 5
5 # or the terms of the Artistic License version 2 or the terms of the
6 # MIT License (Expat version). See the file COPYING.md that came
7 # bundled with this file.
8 #
9  
10 =head1 NAME
11  
12 Chj::Unix::Exitcode
13  
14 =head1 SYNOPSIS
15  
16 =head1 DESCRIPTION
17  
18  
19 =head1 NOTE
20  
21 This is alpha software! Read the status section in the package README
22 or on the L<website|http://functional-perl.org/>.
23  
24 =cut
25  
26 package Chj::Unix::Exitcode;
27 80 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 80 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 80 ▶use warnings FATAL => 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
30 80 ▶use Exporter "import";
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 80 our @EXPORT = qw(exitcode);
33 80 our @EXPORT_OK = qw(exitcode);
34 80 our %EXPORT_TAGS = (all => \@EXPORT_OK);
35  
36 80 ▶use FP::Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 80 package Chj::Unix::Exitcode::Exitcode {
39  
40 80 ▶ use Chj::Unix::Signal;
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 80 ▶ use Chj::Class::Array -fields => -publica => 'code',
Subroutine BEGIN: called CC=1 SCAR=0.0
43 80 ;
44  
45 0 ▶ sub new {
Subroutine new: not called CC=1 SCAR=6.9
46 0 my $class = shift;
47 0 my $s = $class->SUPER::new;
48 0 ($$s[Code]) = @_;
49 0 $s
50 }
51  
52 0 ▶ sub as_string {
Subroutine as_string: not called CC=3 SCAR=24.8
53 0 my $s = shift;
54 0 my $code = $$s[Code];
55 0 ▶ if ($code < 256) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code < 256) { } 0 0 0
56 0 "signal $code (" . Chj::Unix::Signal->new($code)->as_string . ")"
57 } else {
58 0 ▶ if (($code & 255) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (($code & 255) == 0) { } 0 0 0
59 0 "exit value " . ($code >> 8)
60 } else {
61 0 warn "does this ever happen?";
62 0 "both exit value and signal ($code)"
63 }
64 }
65 }
66  
67 80 end Chj::Class::Array;
68 }
69  
70 0 ▶sub exitcode {
Subroutine exitcode: not called CC=2 SCAR=17.9
Pod undocumented
71 0 ▶ @_ == 1 or fp_croak_arity 1;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or fp_croak_arity(1) 0 0 0
72 0 my ($code) = @_;
73 0 Chj::Unix::Exitcode::Exitcode->new($code)->as_string;
74 }
75  
76 80 1
« lib/FP/Repl/StackPlus.pm ↑ Summary lib/FP/Weak.pm »