Errors Output
  1. Can't connect to host! at /home/gunwiki/public_html/apps/calconversion/index.asp line 27. , /usr/local/share/perl5/5.32/Apache/ASP.pm line 1522
Debug Output
  1. Can't connect to host! at /home/gunwiki/public_html/apps/calconversion/index.asp line 27. , /usr/local/share/perl5/5.32/Apache/ASP.pm line 1522
ASP to Perl Script 

  -: no strict;;use vars qw($Application $Session $Response $Server $Request);;
  -: #line 1 /home/gunwiki/public_html/apps/calconversion/index.asp
  1: ;;&Apache::ASP::WriteRef($main::Response, \('<html><title>Dillon Press Caliber Conversion Finder</title>
  2: <h1>Caliber Conversion Finder</h1>
  3: <i>An app by Sean Newton, for <a href="http://gunwiki.net/">GunWiki.net</a></i><br>
  4: <!-- Start Quantcast tag -->
  5: <script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script>
  6: <script type="text/javascript">_qacct="p-faLAPZ5cHPzB2";quantserve();</script>
  7: 
  8: <noscript>
  9: <a href="http://www.quantcast.com/p-faLAPZ5cHPzB2" target="_blank"><img src="http://pixel.quantserve.com/pixel/p-faLAPZ5cHPzB2.gif" style="display: none;" border="0" height="1" width="1" alt="Quantcast"/></a>
 10: </noscript>
 11: <!-- End Quantcast tag -->
 12: <br>
 13: If this application has helped you, please consider making <a href="http://gunwiki.net/Gunwiki/DonatePage">a small donation</a> to GunWiki.  <i>Particularly</i> if this app has shown
 14: you how to avoid buying an $80 caliber conversion by picking up one or two inexpensive parts!<p>
 15: Please note that the <a href="http://www.gunwiki.net/Gunwiki/RefCaliberConversionApp">instructions</a> contain some
 16: non-obvious information you should probably read before you just start clicking away.  Of course, if you <i>really</i> want
 17: to just start clicking, feel free.
 18: <p>
 19: '));
 20: use strict;
 21: #use CGI; use Data::Dumper; my $q=new CGI;
 22: my %OwnedConversions;
 23: my %OwnedParts;
 24: my %DesiredConversions;
 25: my %DesiredParts;
 26: 
 27: my $dbh=CS::MakeConnect('gunwiki') or die "Can't connect to host!";
 28: my %Machines=CS::LoadHash($dbh, 'calconv_machine', 'id,descr');
 29: my $Action=$Request->QueryString('go');
 30: #my $Action=$q->param('go');
 31: my %Conversion=CS::LoadHash($dbh, 'calconv_conversion', 'id,descr');
 32: my %MachConv=CS::LoadHash($dbh, 'calconv_conversion', 'id,machine');
 33: 
 34: #my $Action;
 35: #print Dumper $Request->Params;
 36: #my $Caw=$q->Vars;
 37: #print Dumper $Caw;
 38: #print "<p>\n";
 39: 
 40: my $MachineList=$Request->QueryString('ml');
 41: $MachineList='' unless($MachineList=~m/^[\d,]+$/);
 42: 
 43: my $Gray  ='#A0A0A0';
 44: my $Green ='#80FF80';
 45: my $Red   ='#FF4040';
 46: my $Yellow='#FFFF80';
 47: 
 48: ; &Apache::ASP::WriteRef($main::Response, \('<form action="index.asp" method="get">
 49: '));
 50: 
 51: if($Action eq '')
 52:  {
 53:   my %MachinePop=CS::LoadHash($dbh, 'calconv_conversion', 'machine,count(*)', '1=1 GROUP BY machine');
 54: ; &Apache::ASP::WriteRef($main::Response, \('Please choose which machine you wish to look at conversions for.  Be warned that although you may select multiple machines, the next caliber conversion lists will get very long if you do so.<br>
 55: So realistically, unless you intend to mix and match parts across machines (which is possible in some cases), you should only run one machine at a time.
 56: <p>
 57: <h3>Which Dillon presses do you want to consider conversions for?</h3>
 58: <table border="1">
 59: <tr bgcolor="'.($Gray).'"><th>&nbsp;</th><th>Press</th><th>Conversions On File</th></tr>
 60: '));
 61:   foreach (sort keys %Machines)
 62:    {
 63:     next unless($MachinePop{$_} ne '');
 64:     printf "<tr><td><input type=\"checkbox\" name=\"machine_%d\"><td>%s</td><td>%s</td></tr>\n", $_, $Machines{$_}, $MachinePop{$_};
 65:    }
 66: ; &Apache::ASP::WriteRef($main::Response, \('
 67: <tr><td colspan=3><center><input type="submit" name="go" value="Choose Machines"></center></td></tr>
 68: </table>
 69: </form>
 70: <p>
 71: In case you can\'t find the caliber you\'re looking for, you may request a new conversion <a href="request_caliber.asp">here</a>.<br>
 72: I don\'t have a lot of major connections, but I do periodically beg Dillon and Brian Enos for more info.
 73: '));
 74:   $dbh->disconnect;
 75:   return;
 76:  } elsif($Action eq 'Choose Machines') {
 77:   foreach(keys %Machines) { $MachineList.="$_,"if($Request->QueryString('machine_'.$_) eq 'on'); }
 78:   $MachineList=~s/,$//;
 79:  }
 80: ; &Apache::ASP::WriteRef($main::Response, \('<p>
 81: <a href="index.asp">Back to Machine Selection</a><p>
 82: '));
 83: 
 84: if($MachineList ne '') { ; &Apache::ASP::WriteRef($main::Response, \('<input type="hidden" name="ml" value="'.($MachineList).'">')); }
 85: 
 86: {
 87:  my @MachineArr=split(',', $MachineList);
 88:  foreach my $Machine (@MachineArr)
 89:   {
 90:    my %MachConversions=CS::LoadHash($dbh, 'calconv_conversion', 'id,machine', 'machine='.$Machine);
 91:    my @List;
 92:    my $Count;
 93:    foreach(sort { $Conversion{$a} cmp $Conversion{$b} } keys %MachConversions)
 94:     {
 95:      my $Line;
 96:      ++$Count;
 97:      my ($CheckHave, $CheckWant, $CheckDontCare);
 98:      if($Request->QueryString('cal_'.$_) eq 'H')
 99:       {
100:        $CheckHave=' CHECKED';
101:        $OwnedConversions{$_}=1;
102:       } elsif($Request->QueryString('cal_'.$_) eq 'W') {
103:        $CheckWant=' CHECKED';
104:        $DesiredConversions{$_}=1;
105:       } else { $CheckDontCare=' CHECKED'; }
106:      $Line.='<td><a href="showconvparts.asp?convid='.$_.'">'.$Conversion{$_}.'</a></td>';
107:      $Line.="<td><input type=\"radio\" name=\"cal_$_\" value=\"H\"$CheckHave></td>";
108:      $Line.="<td><input type=\"radio\" name=\"cal_$_\" value=\"W\"$CheckWant></td>";
109:      $Line.="<td><input type=\"radio\" name=\"cal_$_\" value=\"D\"$CheckDontCare></td>";
110:      push @List, $Line;
111:     }
112:    my $Count=0;
113:    my $Cols=3;
114:    my $Buf=sprintf "<table border=\"1\">\n<tr><th colspan=\"14\">Conversions for %s</th></tr><tr bgcolor=\"#D0D0D0\">", $Machines{$Machine};;
115:    while($Count<$Cols) { $Buf.="<th>Caliber</th><th>Have</th><th>Want</th><th>Don't Care</th>\n"; $Count++; $Buf.='<td bgcolor="#808080">&nbsp;</td>' if($Count<$Cols); }
116:    $Buf.='</tr><tr>';
117:    $Count=1;
118:    my $Lines=0;
119:    my $PerColumn=int(@List/$Cols);
120:    ++$PerColumn if(@List/$Cols);
121: #  printf "Columns requested: %d, number of calibers in block: %d, per column: %f\n", $Cols, scalar(@List), $PerColumn;
122: 
123:    my $Lines=0;
124:    while(($Lines*$Cols)<@List)
125:     {
126:      $Buf.=sprintf "</tr>\n<tr bgcolor=\"%s\">", ($Lines%2)?'#F0F0F0':'#FFFFFF';
127:      $Buf.=@List[$Lines];
128:      my $Across=1;
129:      while($Across<$Cols)
130:       {
131:        $Buf.='<td bgcolor="#808080">&nbsp;</td>';
132:        $Buf.=@List[($Lines+($PerColumn*$Across))];
133:        ++$Across;
134:       }
135:      ++$Lines;
136:     }
137:    $Buf.='</tr></table>';
138:    print $Buf;
139:   }
140: }
141: ; &Apache::ASP::WriteRef($main::Response, \('<input type="submit" name="go" value="Compute Conversion"><input type="submit" name="go" value="Spreadsheet View"></form>
142: '));
143: if($Request->QueryString('go') ne '') {
144: 
145: my %PartType=CS::LoadHash($dbh, 'calconv_parttype', 'id,descr');
146: 
147: my (%PartID, %PartDesc, %PartFriendly);
148: {
149:  my ($id, $type, $designation);
150:  my $sth=CS::SelectRecs($dbh, 'calconv_part', 'id,parttype,designation', '', \$id, \$type, \$designation);
151:  while($sth->fetch)
152:   { $PartID{$id}=$type; $PartDesc{$id}=$designation; $PartFriendly{$id}=$PartType{$type}.' '.$designation }
153:  $sth->finish;
154: }
155: 
156: my %SpreadOut;
157: my %TypeColumns;
158: {
159:  my ($conversion, $part);
160:  my $sth=CS::SelectRecs($dbh, 'calconv_conversion_parts', 'conversion,part', undef, \$conversion, \$part);
161:  while($sth->fetch)
162:   {
163:    next unless($OwnedConversions{$conversion}||$DesiredConversions{$conversion});
164:    $TypeColumns{$PartType{$PartID{$part}}}=1;
165:    $SpreadOut{$conversion}{$PartType{$PartID{$part}}}.=','.$part;
166:    if($OwnedConversions{$conversion}) { $OwnedParts{$part}=1; }
167:    if($DesiredConversions{$conversion}) { $DesiredParts{$part}=1; }
168:   }
169:  $sth->finish;
170: }
171: 
172: if($Request->QueryString('go') eq 'Spreadsheet View')
173:  {
174:   print "<b>Legend:</b><br>";
175:   print "<table border=\"1\">\n";
176:   print "<tr><td bgcolor=\"$Green\"><b>Have</b></td></tr>\n";
177:   print "<tr><td bgcolor=\"$Red\"><b>Don't have, want</b></td></tr>\n";
178:   print "<tr><td bgcolor=\"$Gray\"><b>N/A</b></td></tr>\n";
179:   print "</table><p>\n";
180:   print "<table border=\"1\">\n<tr><th>Machine</th><th>Caliber</th>";
181:   foreach(sort keys %TypeColumns) { print " <th>$_</th>\n"; }
182:   print "</tr>\n";
183:   foreach my $conversion (sort keys %SpreadOut)
184:    {
185:     next unless($DesiredConversions{$conversion}||$OwnedConversions{$conversion});
186:     my $CellColor=$Green;
187:     my ($Missing, $ConvBuf);
188:     foreach my $blah (sort keys %TypeColumns)
189:      {
190:       my $Temp=$SpreadOut{$conversion}{$blah};
191:       $Temp=~s/^,//;
192:       my $Cell;
193:       my $bgcolor=$Gray;
194:       my @List=split (',', $Temp);
195:       $Cell.='<table border="0">' if(@List gt 1);
196:       foreach my $Part (@List)
197:        {
198:         my $PartDescription="<a href=\"convsusingpart.asp?part=$Part\">".$PartDesc{$Part}.'</a>';
199:         ++$Missing;
200:            if($OwnedParts{$Part}  ) { $bgcolor='#80FF80'; }
201:         elsif($DesiredParts{$Part})
202:          {
203:           if($DesiredConversions{$conversion}) { $bgcolor='#FF4040'; } else { $bgcolor='#FFFF80'; }
204:          }
205:         else { $bgcolor=$Gray; }
206:         if(@List gt 1)
207:          { $Cell.='<tr><td bgcolor="'.$bgcolor.'">'.$PartDescription.'</td></tr>'; }
208:         else { $Cell=$PartDescription; }
209:        }
210:       if(@List gt 1) { $ConvBuf.=" <td>$Cell</table></td>\n"; }
211:        else { $ConvBuf.=" <td bgcolor=\"$bgcolor\">$Cell&nbsp;</td>\n"; }
212:      }
213:     printf "<tr><td>%s</td><td bgcolor=\"#%s\"><a href=\"showconvparts.asp?convid=%s\">%s</a></td>$ConvBuf</tr>\n", $Machines{$MachConv{$conversion}}, 'FFFFFF', $conversion, $Conversion{$conversion};
214:    }
215:   print "</table>\n";
216:  }
217: else
218:  {
219:   my %Manufacturer=CS::LoadHash($dbh, 'calconv_manufacturer', 'id,descr');
220:   my %PartManufacturers=CS::LoadHash($dbh, 'calconv_part', 'id,manufacturer');
221:   my %PartSKUs=CS::LoadHash($dbh, 'calconv_part', 'id,sku');
222:   print "\n<p>Parts Used For Conversion:<br>\n<table border=\"1\"><th>Status</th><th>Manufacturer</th><th>Item</th><th>SKU</th></tr>\n";
223:   foreach(sort { $PartFriendly{$a} cmp $PartFriendly{$b} } keys %DesiredParts)
224:    {
225:     my $bgcolor=$OwnedParts{$_}?'#80FF80':'#FF4040';
226:     $bgcolor="\"$bgcolor\"";
227:     printf "<tr bgcolor=$bgcolor><td>%s</td><td>%s</td><td>%s %s</td><td><a href=\"convsusingpart.asp?part=%s\">%s</a>&nbsp;</td></tr>\n", $OwnedParts{$_}?'HAVE':'NEED', $Manufacturer{$PartManufacturers{$_}}, $PartType{$PartID{$_}}, $PartDesc{$_}, $_, $PartSKUs{$_};
228:    }
229:  }
230: }
231: $dbh->disconnect;
232: ; 


An error has occured with the Apache::ASP script just run. If you are the developer working on this script, and cannot work through this problem, please try researching it at the Apache::ASP web site, specifically the FAQ section. Failing that, check out your support options, and if necessary include this debug output with any query.