Wizard/Elem/Select/Shell.pm

filter: Statementstmt 30.0% 9 / 30 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 2 / 3 Podpod 0.0% 0 / 1 totaltotal 20.0% 11 / 55 CC 11 SCAR 47.2
CC
11
Cov
18%
Display
132.0
BEGIN
1.0
BEGIN
1.0
CRAP 111.8
↑ Summary Wizard/Examples/Apache/Admin.pm »
1 # -*- perl -*-
2 #
3 # Wizard - A Perl package for implementing system administration
4 # applications in the style of Windows wizards.
5 #
6 #
7 # This module is
8 #
9 # Copyright (C) 1999 Jochen Wiedmann
10 # Am Eisteich 9
11 # 72555 Metzingen
12 # Germany
13 #
14 # Email: joe@ispsoft.de
15 # Phone: +49 7123 14887
16 #
17 # and Amarendran R. Subramanian
18 # Grundstr. 32
19 # 72810 Gomaringen
20 # Germany
21 #
22 # Email: amar@ispsoft.de
23 # Phone: +49 7072 920696
24 #
25 # All Rights Reserved.
26 #
27 # You may distribute under the terms of either the GNU General Public
28 # License or the Artistic License, as specified in the Perl README file.
29 #
30 # $Id$
31 #
32  
33 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 1 ▶use Wizard::Elem::Shell ();
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37  
38 package Wizard::Elem::Select::Shell;
39  
40 1 @Wizard::Elem::Select::Shell::ISA = qw(Wizard::Elem::Shell);
41 1 $Wizard::Elem::Select::Shell::VERSION = '0.01';
42  
43  
44 0 ▶sub Display {
Subroutine Display: not called CC=11 SCAR=48.8
Pod undocumented
45 0 my($self, $wiz, $form, $state) = @_;
46 0 my $options = $self->{'options'};
47 0 my $value = $self->{'value'};
48 0 my $name = $self->{'name'};
49 0 ▶ return $wiz->param($name, '') unless defined($options);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $options 0 0 0
50 0 ▶ return $wiz->param($name, $options) unless ref($options) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $options eq "ARRAY" 0 0 0
51 0 ▶ return $wiz->param($name, '') unless @$options;
Branch: 1 branch
BranchTrueFalseTotal
unless @$options 0 0 0
52  
53 0 $form->print("$self->{'descr'}:\n");
54 0 my $i = 0;
55 0 my $num = 1;
56 0 foreach my $opt (@$options) {
57 0 ▶ $form->print((($opt eq $value) ? ' ($)' : ' ') . ++$i
Branch: 1 branch
BranchTrueFalseTotal
$opt eq $value ? : 0 0 0
58 . ": $opt\n");
59 0 ▶ $num = $i if ($opt eq $value);
Branch: 1 branch
BranchTrueFalseTotal
if $opt eq $value 0 0 0
60 }
61 0 while (1) {
62 0 $form->print("\nEnter a number: [$num] ");
63 0 my $reply = $form->readline();
64 0 chomp $reply;
65 0 ▶ $reply = $num if $reply eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $reply eq "" 0 0 0
66 0 ▶ next unless $reply =~ /^\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $reply =~ /^\d+$/ 0 0 0
67 0 ▶ next if $reply == 0 || $reply > @$options;
Branch: 1 branch
BranchTrueFalseTotal
if $reply == 0 or $reply > @$options 0 0 0
Condition0%0/3
$reply == 0 or $reply > @$options
l!l&&r!l&&!r
000
MC/DC0%0/2
$reply == 0 or $reply > @$options
$reply == 0 $reply > @$options
Truth table0%0/3
A or B
A= $reply == 0B= $reply > @$options
ABresult
1X1
011
000
68 0 return $wiz->param($name, $options->[$reply-1]);
69 }
70 }
71  
72  
73 1 1;
74  
75  
76  
↑ Summary Wizard/Examples/Apache/Admin.pm »