Online Store Application Implementation

 

 

 

Three CGI programs maintain the finite state machines for three ICs.

 

 

 

Segment of Company.cgi

 

 

if ($state==0) {

          if (param('msg') eq 'Order') {

                   $state=1;

                   state1();

          }

          else {state0();}

}

 

elsif ($state==1) {

          if (param('msg') eq 'Available') {

                   $state=2;

                   state2();

          }

          elsif (param('msg') eq 'Not Available') {

                   $state=4;

                   state4();

          }

          else {

                   state1();

          }

}

 

elsif ($state==2) {

          if (param('msg') eq 'Delievered') {

                   $state=3;

                   state3();

          }

          else {state2();}

}

 

elsif ($state==3) {

          state0();

          $state=0;

}

 

elsif ($state==4) {

          state0();

          $state=0;

}

 

else {

          print "</html>";

          exit;

}

 

 

Click here to download Company.cgi.