blib/lib/IPC/Signal.pm

filter: Statementstmt 91.8% 34 / 37 Branchbran 57.1% 8 / 14 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 75.3% 52 / 69 CC 11 SCAR 19.0
CC
11
Cov
77%
sig_translate_setup
10.9
AUTOLOAD
3.4
BEGIN
1.0
CRAP 6.7
↑ Summary
1 # $Id: Signal.pm,v 1.4 1998-10-27 16:16:13-05 roderick Exp $
2 #
3 # Copyright (c) 1997 Roderick Schertler. All rights reserved. This
4 # program is free software; you can redistribute it and/or modify it
5 # under the same terms as Perl itself.
6  
7 package IPC::Signal;
8  
9 1 ▶use 5.003_94; # __PACKAGE__
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use vars qw($VERSION @ISA @EXPORT_OK $AUTOLOAD %Sig_num @Sig_name);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 require Exporter;
14  
15 1 $VERSION = '1.00';
16 1 @ISA = qw(Exporter);
17 1 @EXPORT_OK = qw(sig_num sig_name sig_translate_setup %Sig_num @Sig_name);
18 1 %Sig_num = ();
19 1 @Sig_name = ();
20  
21 sub sig_num ($);
22 sub sig_name ($);
23  
24 1 ▶sub sig_translate_setup () {
Subroutine sig_translate_setup: called CC=9 SCAR=23.9
Pod documented
25 1 ▶ return if %Sig_num && @Sig_name;
Branch: 1 branch
BranchTrueFalseTotal
if %IPC::Signal::Sig_num and @IPC::Signal::Sig_name 0 1 1
Condition33%1/3
%IPC::Signal::Sig_num and @IPC::Signal::Sig_name
!ll&&!rl&&r
100
MC/DC0%0/2
%IPC::Signal::Sig_num and @IPC::Signal::Sig_name
%IPC::Signal::Sig_num @IPC::Signal::Sig_name
Truth table33%1/3
A and B
A= %IPC::Signal::Sig_numB= @IPC::Signal::Sig_name
ABresult
0X0
100
111
26  
27 1 require Config;
28  
29 # In 5.005 the sig_num entries are comma separated and there's a
30 # trailing 0.
31 1 my $num = $Config::Config{'sig_num'};
32 1 ▶ if ($num =~ s/,//g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($num =~ s/,//g) 0 1 1
33 0 $num =~ s/\s+0$//;
34 }
35  
36 1 my @name = split ' ', $Config::Config{'sig_name'};
37 1 my @num = split ' ', $num;
38  
39 1 ▶ @name or die 'No signals defined';
Branch: 1 branch
BranchTrueFalseTotal
@name or die "No signals defined" 1 0 1
40 1 ▶ @name == @num or die 'Signal name/number mismatch';
Branch: 1 branch
BranchTrueFalseTotal
@name == @num or die "Signal name/number mismatch" 1 0 1
41  
42 1 @Sig_num{@name} = @num;
43 1 ▶ keys %Sig_num == @name or die 'Duplicate signal names present';
Branch: 1 branch
BranchTrueFalseTotal
keys %IPC::Signal::Sig_num == @name or die "Duplicate signal names present" 1 0 1
44 1 for (@name) {
45 $Sig_name[$Sig_num{$_}] = $_
46 68 ▶ unless defined $Sig_name[$Sig_num{$_}];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $IPC::Signal::Sig_name[$IPC::Signal::Sig_num{$_}] 65 3 68
47 }
48 }
49  
50 # This autoload routine just is just for sig_num() and sig_name(). It
51 # calls sig_translate_setup() and then snaps the real function definitions
52 # into place.
53  
54 1 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=12.3
55 1 ▶ if ($AUTOLOAD ne __PACKAGE__ . '::sig_num'
Branch: 1 branch
BranchTrueFalseTotal
if ($IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_num" and $IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_name") 0 1 1
Condition33%1/3
$IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_num" and $IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_name"
!ll&&!rl&&r
100
MC/DC0%0/2
$IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_num" and $IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_name"
$IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_num" $IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_name"
Truth table33%1/3
A and B
A= $IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_num"B= $IPC::Signal::AUTOLOAD ne "IPC::Signal::sig_name"
ABresult
0X0
100
111
56 && $AUTOLOAD ne __PACKAGE__ . '::sig_name') {
57 0 require Carp;
58 0 Carp::croak("Undefined subroutine &$AUTOLOAD called");
59 }
60 1 sig_translate_setup;
61 1 ▶ *sig_num = sub ($) { $Sig_num{$_[0]} };
Subroutine __ANON__: called CC=1 SCAR=0.0
62 1 ▶ *sig_name = sub ($) { $Sig_name[$_[0]] };
Subroutine __ANON__: called CC=1 SCAR=0.0
63 1 goto &$AUTOLOAD;
64 }
65  
66 1 1
67  
68 __END__
↑ Summary