[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-WebCGI] help



Hello everyone:

Before I post this question let me wish everyone in
the list Merry Christmas And A Very Happy And
Prosperous New Year!!

I am trying to resolve this problem for a long time.
I have failed and I have to seek your help.

When I run the following subroutine the syntax looks
okay.  It gives diagnostic error that:

############################################################

# "my" variable $inc masks earlier declaration in same
scope.
File 'Untitled'; Line 4
############################################################

the subroutine follows:

# Sub: Add New Item
# This allows a new item to be put up for sale

sub new {
 my $inc = '1.00'; # default increment{
 my($title, $reserve, $inc, $desc, $image, @bids);
 if ($form{'REPOST'}) {
  $form{'REPOST'} =~ s/\W//g;
  if (-T
"$config{'basepath'}$config{'closedir'}/$form{'REPOST'}.dat")
{
   open THEFILE,
"$config{'basepath'}$config{'closedir'}/$form{'REPOST'}.dat";

   ($title, $reserve, $inc, $desc, $image, @bids) =
<THEFILE>;
   close THEFILE;
   chomp($title, $reserve, $inc, $desc, $image, @bids);
   $title =~ s/\"//g;  # quotes cause problems for a text
input field
  }
 }
 print <<"EOF";
<FORM ACTION=$ENV{'SCRIPT_NAME'} METHOD=POST>
<H2>Post A New Item</H2>
<TABLE WIDTH=100% BORDER=1
BGCOLOR=$config{'colortablebody'}>
<INPUT TYPE=HIDDEN NAME=action VALUE=procnew>
<TR><TD VALIGN=TOP><B>Title/Item Name:<BR></B>No
HTML</TD><TD><INPUT NAME=TITLE VALUE=\"$title\" TYPE=TEXT
SIZE=50 MAXLENGTH=50></TD></TR>
<TR><TD VALIGN=TOP><B>Category:<BR></B>Select
One</TD><TD><SELECT NAME=CATEGORY>
<OPTION SELECTED></OPTION>
EOF
 my $key;
 foreach $key (sort keys %category) {
  print "<OPTION VALUE=\"$key\">$category{$key}</OPTION>\n";

 }
 print <<"EOF";
</SELECT></TD></TR>
<TR><TD VALIGN=TOP><B>Image URL:<BR></B>Optional, should be
no larger than 200x200</TD><TD><INPUT NAME=IMAGE
VALUE=\"$image\" TYPE=TEXT SIZE=50
VALUE="http://"></TD></TR>
<TR><TD VALIGN=TOP><B>Days Until
Close:<BR></B>1-14</TD><TD><INPUT NAME=DAYS TYPE=TEXT SIZE=2
MAXLENGTH=2></TD></TR>
<TR><TD VALIGN=TOP><B>Description:<BR></B>May include HTML -
This should include the condition of the item, payment and
shipping information, and
any other information the buyer should
know.</TD><TD><TEXTAREA NAME=DESC ROWS=5
COLS=45>$desc</TEXTAREA></TD></TR>
<TR><TD COLSPAN=2 VALIGN=TOP>Please note that by placing an
item up for bid you are making a contract between you and
the buyer.
Once you place an item, you may not retract it and you must
sell it for the highest bid. In other words, if you don't
want to sell it, don't place it up for bid!
EOF

 if ($config{'regdir'}) {
  print <<"EOF";
<P><B><A
HREF="$ENV{'SCRIPT_NAME'}?action=reg">Registration</A> is
required to post or bid!</B></TD></TR>
<TR><TD VALIGN=TOP><B>Your Handle/Alias:<BR></B>Used to
track your post</TD><TD><INPUT NAME=ALIAS TYPE=TEXT SIZE=30
MAXLENGTH=30>
<TR><TD VALIGN=TOP><B>Your Password:<BR></B>Must be
valid</TD><TD><INPUT NAME=PASSWORD TYPE=PASSWORD SIZE=30>
<TR><TD VALIGN=TOP><B>Your Starting
Bid:</B></TD><TD>\$<INPUT NAME=BID TYPE=TEXT SIZE=7 VALUE=0>

<TR><TD VALIGN=TOP><B>Your Reserve Price:<BR></B>You are not
obligated to sell below this price.  Leave blank if
none.</TD><TD>\$<INPUT NAME=RESERVE TYPE=TEXT SIZE=7
VALUE=0>
<TR><TD VALIGN=TOP><B>Bid Increment:</B></TD><TD>\$<INPUT
NAME=INC TYPE=TEXT SIZE=7 VALUE="$inc"></TD></TR></TABLE>
EOF
 }
 else {
  print <<"EOF";
</TD></TR>
<TR><TD VALIGN=TOP><B>Your Handle/Alias:<BR></B>Used to
track your post</TD><TD><INPUT NAME=ALIAS TYPE=TEXT SIZE=30
MAXLENGTH=30>
<TR><TD VALIGN=TOP><B>Your E-Mail Address:<BR></B>Must be
valid</TD><TD><INPUT NAME=EMAIL TYPE=TEXT SIZE=30>
<TR><TD VALIGN=TOP><B>Your Starting
Bid:</B></TD><TD>\$<INPUT NAME=BID TYPE=TEXT SIZE=7 VALUE=0>

<TR><TD VALIGN=TOP><B>Your Reserve Price:<BR></B>You are not
obligated to sell below this price.  Leave blank if
none.</TD><TD>\$<INPUT NAME=RESERVE TYPE=TEXT SIZE=7
VALUE=0>
<TR><TD VALIGN=TOP><B>Bid Increment:</B></TD><TD>\$<INPUT
NAME=INC TYPE=TEXT SIZE=7 VALUE="$inc">
<TR><TD VALIGN=TOP><B>Contact Information:<BR></B>Will be
given out only to the buyer</TD><TD>
<TT>Full Name: </TT><BR><INPUT NAME=ADDRESS1 TYPE=TEXT
SIZE=30><BR>
<TT>Street Address: </TT><BR><INPUT NAME=ADDRESS2 TYPE=TEXT
SIZE=30><BR>
<TT>City, State, ZIP: </TT><BR><INPUT NAME=ADDRESS3
TYPE=TEXT SIZE=30></TD></TR></TABLE>
EOF
 }
 print <<"EOF";
<CENTER><INPUT TYPE=SUBMIT VALUE=Preview></CENTER>
EOF
}
}



==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org