blib/lib/MPE/Suprtool.pm

filter: Statementstmt 18.7% 6 / 32 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 2 / 8 Podpod n/a totaltotal 17.3% 8 / 46 CC 5 SCAR 19.2
CC
5
Cov
16%
new
12.0
cmd
12.0
status
2.0
CRAP 6.8
↑ Summary Suprtool.xs »
1 package MPE::Suprtool;
2  
3 require 5.005_62;
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 require Exporter;
8 require DynaLoader;
9 our @ISA = qw(Exporter DynaLoader);
10  
11 our @EXPORT_OK = ( );
12 our @EXPORT = ( );
13 our $VERSION = '0.51';
14  
15  
16 bootstrap MPE::Suprtool $VERSION;
17 my $plabel;
18  
19 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
20 0 my $class = shift;
21 0 my %defaults = (
22 pri => ' ',
23 printstate => 'ER',
24 xl => configst2loc()
25 );
26 0 my %opt = (%defaults, @_);
27 0 my $self;
28 0 ▶ $plabel = getsuprcall("\0$opt{xl}\0") unless defined($plabel);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $plabel 0 0 0
29 0 ▶ if (!$plabel) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($plabel) 0 0 0
30 0 return undef;
31 }
32 $self = pack("nnA256A2NA2A2A18A270NA20",
33 0 4, 0, " ", $opt{pri}, 0, $opt{printstate}, "AS", " ", " ", 0, " ");
34 # n n A256 A2 N A2 A2 A18 A270 N A20
35 0 return bless \$self, $class;
36 }
37  
38 0 ▶sub cmd {
Subroutine cmd: not called CC=3 SCAR=24.8
39 0 my $self = shift;
40 0 my $cmdstr;
41 my $result;
42 0 for $cmdstr (@_) {
43 0 substr($$self, 4, 256) = pack("A256", $cmdstr);
44 0 ▶ last unless $result=suprcall($$self);
Branch: 1 branch
BranchTrueFalseTotal
unless $result = suprcall($$self) 0 0 0
45 }
46 0 return $result;
47 }
48  
49 0 ▶sub status {
Subroutine status: not called CC=1 SCAR=6.9
50 0 my $self = shift;
51 0 unpack("n",substr($$self, 2,2));
52 }
53  
54 0 ▶sub lastcmd {
Subroutine lastcmd: not called CC=1 SCAR=6.9
55 0 my $self = shift;
56 0 unpack("A256",substr($$self, 4, 256));
57 }
58  
59 0 ▶sub count {
Subroutine count: not called CC=1 SCAR=6.9
60 0 my $self = shift;
61 0 unpack("N",substr($$self, 558,4));
62 }
63  
64 0 ▶sub totals {
Subroutine totals: not called CC=1 SCAR=6.9
65 0 my $self = shift;
66 0 my $totalstr = substr($$self, 288, 270);
67 0 my @j;
68 my @k;
69  
70 0 $totalstr =~ s/( {18})+$//;
71 0 unpack "A18"x(length($totalstr)/18), $totalstr;
72 }
73  
74  
75 1;
76 __END__
↑ Summary Suprtool.xs »