Wizard/Shell.pm

filter: Statementstmt 36.6% 11 / 30 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 37.5% 3 / 8 Podpod 0.0% 0 / 5 totaltotal 20.9% 14 / 67 CC 10 SCAR 35.7
CC
10
Cov
22%
param
72.0
new
6.0
State
6.0
CRAP 35.6
« HTML/EP/Wizard.pm ↑ Summary Wizard/Form/HTML.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 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 ▶use Wizard::Form::Shell ();
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37  
38 =pod
39  
40 =head1 NAME
41  
42 Wizard::Shell - A subclass for running Wizard applications in a shell.
43  
44  
45 =head1 SYNOPSIS
46  
47 # Create a new shell wizard
48 use Wizard::Shell;
49 my $wiz = Wizard::Shell->new('form' => $form)
50  
51  
52 =head1 DESCRIPTION
53  
54 The Shell wizard is a subclass of Wizard, that will run in a shell. The
55 input elements are written to stdout and the application will query you
56 for input.
57  
58 =cut
59  
60 package Wizard::Shell;
61  
62 1 @Wizard::Shell::ISA = qw(Wizard);
63  
64  
65 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
66 0 my $self = shift; my $attr = shift;
67 0 ▶ $attr->{'formClass'} ||= 'Wizard::Form::Shell';
Condition0%0/2
$attr->{"formClass"} ||= "Wizard::Form::Shell"
l!l
00
MC/DC0%0/1
$attr->{"formClass"} ||= "Wizard::Form::Shell"
$attr->{"formClass"}
Truth table0%0/2
A
A= $attr->{"formClass"}
Aresult
11
00
68 0 $self->SUPER::new($attr);
69 }
70  
71  
72 0 ▶sub State {
Subroutine State: not called CC=2 SCAR=17.9
Pod undocumented
73 0 my $self = shift;
74 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
75 0 $self->{'state'} = shift;
76 }
77 0 $self->{'state'};
78 }
79  
80 0 ▶sub param {
Subroutine param: not called CC=8 SCAR=42.8
Pod undocumented
81 0 my $self = shift;
82 0 ▶ my $params = $self->{'params'} || {};
Condition0%0/2
$self->{'params'} || {}
l!l
00
MC/DC0%0/1
$self->{'params'} || {}
$self->{'params'}
Truth table0%0/2
A
A= $self->{'params'}
Aresult
11
00
83 0 ▶ return keys %$params unless (@_);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
84 0 my $var = shift;
85 0 ▶ my $vars = $params->{$var} || [];
Condition0%0/2
$params->{$var} || []
l!l
00
MC/DC0%0/1
$params->{$var} || []
$params->{$var}
Truth table0%0/2
A
A= $params->{$var}
Aresult
11
00
86 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
87 0 my $val = shift;
88 0 ▶ $vars = (defined($val) and ref($val)) ? $val : [$val];
Branch: 1 branch
BranchTrueFalseTotal
defined $val && ref $val ? : 0 0 0
Condition0%0/3
defined $val and ref $val
!ll&&!rl&&r
000
MC/DC0%0/2
defined $val and ref $val
defined $val ref $val
Truth table0%0/3
A and B
A= defined $valB= ref $val
ABresult
0X0
100
111
89 0 $self->{'params'}->{$var} = $vars;
90 }
91 0 ▶ wantarray ? @$vars : $vars->[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
92 }
93  
94 # Store is a dummy method here, because we need no persistency
95 0 ▶sub Store { }
Subroutine Store: not called CC=1 SCAR=0.0
Pod undocumented
96  
97 0 ▶sub ResetParam { shift->{'params'} = {} }
Subroutine ResetParam: not called CC=1 SCAR=6.9
Pod undocumented
98  
99  
100 1 1;
101  
102 __END__
« HTML/EP/Wizard.pm ↑ Summary Wizard/Form/HTML.pm »