#!/usr/bin/perl # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. use CGI qw/:standard/; use WSO2::WSF; use XML::Twig; my $q = new CGI; $username = $q->cookie('username'); if(!$username) { #print redirect('/cgi-bin/trader_login'); } print $q->header(); if ($q->param('SELL')) { $isSell = $q->param('SELL'); $holdingID = $q->param('HOLDINGID'); $quantity = $q->param('QUANTITY'); $symbol = $q->param('SYMBOL'); } elsif ($q->param('BUY')) { $quantity = $q->param('QUANTITY'); $symbol = $q->param('SYMBOL'); $price = $q->param('PRICE'); $isBuy = $q->param('BUY'); } else { print ("This is not buy or sell."); } print < WSF/PHP StockTrader Welcome

Trade

Trade Confirmation

E if ($isSell) { print("

You have requested to sell all or part of your holding ${holdingID} This holding has a total of ${quantity} shares of stock ${symbol} Please indicate how many share to sell.

"); print("Number of Shares: "); print (""); print (""); } elsif ($isBuy) { print("Number of Shares: "); print("

You have requested to buy shares of ${symbol} which is currently trading at \$${price}

"); print (""); print (""); } else { } print ("
"); print <
E