Wizard/Form/Shell.pm

filter: Statementstmt 22.8% 8 / 35 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 0.0% 0 / 5 totaltotal 18.8% 10 / 53 CC 5 SCAR 26.8
CC
5
Cov
20%
Display
30.0
Option
2.0
print
2.0
CRAP 14.5
« Wizard/Elem/Data/Shell.pm ↑ Summary Wizard/SaveAble/ShellVars.pm »
1 # -*- perl -*-
2 #
3 #
4 # Wizard - A Perl package for implementing system administration
5 # applications in the style of Windows wizards.
6 #
7 #
8 # This module is
9 #
10 # Copyright (C) 1999 Jochen Wiedmann
11 # Am Eisteich 9
12 # 72555 Metzingen
13 # Germany
14 #
15 # Email: joe@ispsoft.de
16 # Phone: +49 7123 14887
17 #
18 # and Amarendran R. Subramanian
19 # Grundstr. 32
20 # 72810 Gomaringen
21 # Germany
22 #
23 # Email: amar@ispsoft.de
24 # Phone: +49 7072 920696
25 #
26 # All Rights Reserved.
27 #
28 # You may distribute under the terms of either the GNU General Public
29 # License or the Artistic License, as specified in the Perl README file.
30 #
31  
32 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 1 ▶use Wizard::Form ();
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36  
37 package Wizard::Form::Shell;
38  
39 1 @Wizard::Form::Shell::ISA = qw(Wizard::Form);
40  
41  
42 0 ▶sub Display {
Subroutine Display: not called CC=5 SCAR=34.0
Pod undocumented
43 0 my($self, $wiz, $state) = @_;
44 0 $self->{'options'} = {};
45 0 $wiz->ResetParam();
46 0 foreach my $elem (@{$self->{'elems'}}) {
47 0 $elem->Display($wiz, $self, $state);
48 }
49 0 my $var;
50 0 ▶ if (keys %{$self->{'options'}} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %{$$self{'options'};} == 1) { } 0 0 0
51 0 $var = (keys %{$self->{'options'}})[0];
52 } else {
53 0 while (1) {
54 0 print "\nSelect an option: ";
55 0 $var = <STDIN>;
56 0 chomp $var;
57 0 ▶ last if exists($self->{'options'}->{$var});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"options"}{$var} 0 0 0
58 }
59 }
60 0 my $val = $self->{'options'}->{$var};
61 0 ▶ if (defined($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $val) { } 0 0 0
62 0 $wiz->param($val, $var);
63 } else {
64 0 $state->Running(0);
65 }
66 }
67  
68 0 ▶sub Option {
Subroutine Option: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my($self, $id, $action) = @_;
70 0 $self->{'options'}->{$id} = $action;
71 }
72  
73 0 ▶sub print { shift; print @_; }
Subroutine print: not called CC=1 SCAR=6.9
Pod undocumented
74 0 ▶sub printf { shift; printf(@_); }
Subroutine printf: not called CC=1 SCAR=6.9
Pod undocumented
75 0 ▶sub readline { <STDIN> }
Subroutine readline: not called CC=1 SCAR=6.9
Pod undocumented
76  
77 1 1;
« Wizard/Elem/Data/Shell.pm ↑ Summary Wizard/SaveAble/ShellVars.pm »