All i am use the switch module to in the example code below.
switch ($subkey) {
case 1 {$acc = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: Account=$acc");}}
case 11 {$ordid = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: OrderId=$ordid");}
+}
case 14 {$lotsfill = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: LotsFilled=$lotsfi
+ll");}}
case 31 {$fillprice = $messagebin{$file}{$subkey};
if($debug){ &writelog(3,"DEBUG: FillPrice=$fillpr
+ice");}}
case 32 {$lotsact = $messagebin{$file}{$subkey};
if($debug){ &writelog(3,"DEBUG: LotsActioned=$lot
+sact");}}
case 34 {$transno = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: TransNo=$transno")
+;}}
# As 35 can contain execution report, we make sur
+e we can handle them.
case 35 {my $new = $messagebin{$file}{$subkey};
if($new =~ m/D/i){$action = "New";if($debug){&wri
+telog(3,"DEBUG: Action=$action");}}
elsif($new =~ m/G/i){$action = "Amend";if($debug)
+{&writelog(3,"DEBUG: Action=$action");}}
elsif($new =~ m/F/i){$action = "Cancel";if($debug
+){&writelog(3,"DEBUG: Action=$action");}}
elsif($new =~ /9/){$action = "Reject";if($debug){
+&writelog(3,"DEBUG: Action=$action");}}
elsif($new =~ /8/){$action = "Report";if($debug){
+&writelog(3,"DEBUG: Action=$action");}}
}
case 37 {$dborderid = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: DBOrderId=$dborder
+id");}}
case 38 {$lotsordered = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: LotsOrdered=$lotso
+rdered");}}
case 40 {$ordertype = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: OrderType=$orderty
+pe");}}
case 41 {$amedorderid = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: AmendOrderId=$amed
+orderid");}}
case 44 {$orderprice = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: OrderPrice=$orderp
+rice");}}
case 50 {$traderid = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: TraderId=$traderid
+");}}
case 54 {my $bs = $messagebin{$file}{$subkey};
if($bs == 1){$buysell = "Buy";if($debug){&writelo
+g(3,"DEBUG: BuySell=$buysell");}}
elsif($bs == 2){$buysell = "Sell";if($debug){&wri
+telog(3,"DEBUG: BuySell=$buysell");}}
}
case 55 {$consid = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: Contract=$consid")
+;}}
case 100 {$exchange = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: Exchange=$exchange
+");}}
case 150 {my $new1 = $messagebin{$file}{$subkey};
if($new1 == 0){$filltype = "Ack";if($debug){&writ
+elog(3,"DEBUG: Action=$action");}}
elsif($new1 == /1/){$filltype = "Part Fill";if($d
+ebug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 == /2/){$filltype = "Full Fill";if($d
+ebug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 == /3/){$filltype = "Done for Day";if
+($debug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 == /4/){$filltype = "Ack Cancel";if($
+debug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 == /5/){$filltype = "Ack Amend";if($d
+ebug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 == /6/){$filltype = "Pending Cancel";
+if($debug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 == /7/){$filltype = "Stopped";if($deb
+ug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 == /8/){$filltype = "Rejected";if($de
+bug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 == /9/){$filltype = "Suspended";if($d
+ebug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 =~ m/A/i){$filltype = "Pending new";i
+f($debug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 =~ m/B/i){$filltype = "Calculated";if
+($debug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 =~ m/C/i){$filltype = "Expired";if($d
+ebug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 =~ m/D/i){$filltype = "Restated";if($
+debug){&writelog(3,"DEBUG: Action=$action");}}
elsif($new1 =~ m/E/i){$filltype = "Pending Replac
+e";if($debug){&writelog(3,"DEBUG: Action=$action");}}
else{$filltype = "Unknown";if($debug){&writelog(3
+,"DEBUG: Action=$action");}}
}
case 151 {$lotsstillopen = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: LotsOpen=$lotsstil
+lopen");}}
case 200 {$maturity = $messagebin{$file}{$subkey};
if($debug){&writelog(3,"DEBUG: Maturity=$maturity
+");}}
}
}
Now the strange thing is when i run this on my OS X Tiger install with the default perl which i think if 5.8 i get no errors, and this is the machine i wrote it on. When i run this code on my gentoo box with
$ perl -v
This is perl, v5.8.3 built for i686-linux
I get the following error.
$ perl engine_reader.pl
Bad switch statement (problem in the code block?) near engine_reader.p
+l line 214
(cuthbe@ferrari)-(08:51 AM Tue Nov 29)-(FIXReader)
$
And if i try and use my activestate version on the gentoo machine, i get the same thing.