ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/SimpleUserInterface.pm
(Generate patch)

Comparing COMP/SCRAM/src/ActiveDoc/SimpleUserInterface.pm (file contents):
Revision 1.1 by williamc, Wed Dec 15 15:56:17 1999 UTC vs.
Revision 1.2 by williamc, Fri Jan 14 18:55:13 2000 UTC

# Line 42 | Line 42 | sub askuser {
42          print "\n\n";
43  
44          foreach $query ( $userquery->querylist() ) {
45 <          # -- informational for each query
46 <          print $userquery->querymessage($query)."\n";
47 <
48 <          # -- ship off to the correct routine based on type
49 <          foreach $command ( @{$self->{allowed_commands}} ) {
50 <             $type=$userquery->querytype($query);
51 <             if ( $command=~/^$type/ ) {
52 <                $rv=$self->_calltype($command, $userquery, $query);
53 <                $found='true';
54 <                last;
55 <             }
56 <          }
57 <          if ( $found ne "true" ) {
58 <                # default to basic
59 <                $rv=$self->_calltype("basic", $userquery, $query);
60 <          }
45 >           $rv=$self->_executequery($userquery,$query);
46          }
47  
48  
# Line 80 | Line 65 | sub askuser {
65          return $rv;
66   }
67  
68 + sub _executequery {
69 +        my $self=shift;
70 +        my $userquery=shift;
71 +        my $query=shift;
72 +
73 +        # -- informational for each query
74 +        print $userquery->querymessage($query)."\n";
75 +
76 +        # -- ship off to the correct routine based on type
77 +        foreach $command ( @{$self->{allowed_commands}} ) {
78 +             $type=$userquery->querytype($query);
79 +             if ( $command=~/^$type/ ) {
80 +                $rv=$self->_calltype($command, $userquery, $query);
81 +                $found='true';
82 +                last;
83 +             }
84 +        }
85 +        if ( $found ne "true" ) {
86 +                # default to basic
87 +                $rv=$self->_calltype("basic", $userquery, $query);
88 +        }
89 +        return $rv;
90 + }
91 +
92   sub _calltype {
93          my $self=shift;
94          my $command=shift;
# Line 90 | Line 99 | sub _calltype {
99          my $rv=$self->$command( $userquery->queryprompt($query), @options );
100  
101          # now process the response
102 <        $userquery->lodgevalue($query,$rv);
102 >        my ($ret,$message,@vals)=$userquery->lodgevalue($query,$rv);
103 >        if ($ret ne 0 ) { # invalid response
104 >          print "Input not valid :";
105 >          print $message->read();
106 >          $rv=$self->_executequery($userquery,$query);
107 >        }
108          return $rv;
109   }
110  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines