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

[MacPerl] Error!



Hello Everyone

I have downloaded a script which is supposed to work on
Windows and Unix.  I am trying to configure it for running 
on my Macintosh.

The syntax shows okay.  But when I run the script I get the
following error.  It has something to do with "my" declaration.

Thank you for the help.


Amitava Basu

###########################################################
# "my" variable $alias masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 251
# "my" variable $email masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 251
# "my" variable $bid masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 251
# "my" variable $time masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 251
# "my" variable $add1 masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 251
# "my" variable $add2 masks earlier declaration in same scope. 
File 'LC 2:MacPerl ƒ:script.pl'; Line 251
# "my" variable $add3 masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 251
# "my" variable $alias masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 272
# "my" variable $email masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 272
# "my" variable $bid masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 272
# "my" variable $time masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 272
# "my" variable $add1 masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 272
# "my" variable $add2 masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 272
# "my" variable $add3 masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 272
# "my" variable @bids masks earlier declaration in same scope.
File 'LC 2:MacPerl ƒ:script.pl'; Line 272
# "my" variable @bids masks earlier declaration in same scope.
####################################################

#!/usr/bin/perl
use vars qw(%config %category %form);
use strict;

# Configuration Section
# Edit these variables!
local %config;

# The Base Directory.  We need an
# absolute path for the base directory.
# Include the trailing slash.  THIS SHOULD
# NOT BE WEB-ACCESSIBLE!

$config{'basepath'} = 'web_store:auction';

# Closed Auction Directory
# This is where closed auction items are stored.
# Leave this blank if you don't want to store
# closed auctions.  It can potentially take
# up quite a bit of disk space.

$config{'closedir'} = 'closed';

# User Registration Directory
# This is where user registrations are stored.
# Leave this blank if you don't want to
# require registration.  It can potentially
# take up quite a bit of disk space.

$config{'regdir'} = 'reg';

# List each directory and its associated
# category name.  These directories should
# be subdirectories of the base directory.

%category = (
 computer => 'Computer Hardware and Software',
 elec => 'Consumer Electronics',
 other => 'Other Junk',
);

# This is the password for deleting auction
# items.

$config{'adminpass'} = 'wtrwwz';

# You need to assign either a mail program or
# a mail host so confirmation e-mails can
# be sent out.
# Leave one commented and one uncommented.
#
# YOU NEED EITHER A MAIL PROGRAM
# $config{'mailprog'} = '/usr/lib/sendmail -t';
#
# OR YOU NEED A MAIL HOST (SMTP)

$config{'mailhost'} = 'localhost';

# This line should be your e-mail address

$config{'admin_address'} = 'aztec\@vsnl.net';

# This line should point to the URL of
# your server.  It will be used for sending
# "you have been outbid" e-mail.  The script
# name and auction will be appended to the
# end automatically, so DO NOT use a trailing
# slash.  If you do not want to send outbid
# e-mail, leave this blank.

$config{'scripturl'} = 'www.your.host.com';

# This will let you define colors for the
# tables that are generated and the
# other page colors.  The default colors
# create a nice "professional" look.  Must
# be in hex format.

$config{'colortablehead'} = '#BBBBBB';
$config{'colortablebody'} = '#EEEEEE';

# Site Name (will appear at the top of each page)

$config{'sitename'} = 'Indian Junk Shop';

# You can configure your own header which will
# be appended to the top of each page.

$config{'header'} =<<"EOF";
<HTML>
<HEAD>
 <TITLE>$config{'sitename'} - Powered By Incasoft</TITLE>
</HEAD>
<BODY TEXT=#000000 BGCOLOR=#FFFFFF LINK=#000088
VLINK=#000088 ALINK=#000088>
 <TABLE WIDTH=100\% BORDER=0><TR><TD VALIGN=TOP WIDTH=100\%>

  <FONT SIZE=+2>$config{'sitename'}</FONT>
  <BR>
  <FONT SIZE=+1>Online Auction</FONT>
 </TD><TD VALIGN=TOP ALIGN=LEFT>
  <FORM ACTION=$ENV{'SCRIPT_NAME'} METHOD=POST>
  <INPUT TYPE=TEXT NAME=searchstring>
  <INPUT TYPE=SUBMIT VALUE="Search">
  <INPUT TYPE=HIDDEN NAME=action VALUE="search">
  <FONT SIZE=-2><INPUT TYPE=RADIO NAME=searchtype
VALUE="keyword" CHECKED>keyword <INPUT TYPE=RADIO
NAME=searchtype VALUE="username">username </FONT>
  </FORM>
 </TD></TR></TABLE>
 <P>
EOF

# You can configure your own footer which will
# be appended to the bottom of each page.
# Although not required, a link back to
# everysoft.com will help to support future
# development.

$config{'footer'} =<<"EOF";
<P>
<CENTER><FONT SIZE=-1><I>Powered By <A
HREF=http://www.Incasoft.com/auction/>Incasoft</A></I></FONT></CENTER>

</BODY>
</HTML>
EOF

# Sniper Protection...  How many minutes
# past last bid to hold auction.  If auctions
# should close at exactly closing time, set
# to zero.

$config{'aftermin'} = 5;

# File locking enabled?  Should be 1 (yes)
# for most systems, but set to 0 (no) if you
# are getting flock errors or the script
# crashes.

$config{'flock'} = 1;

# User Posting Enabled- 1=yes 0=no

$config{'newokay'} = 1;

#-#############################################
# Main Program
# You do not need to edit anything below this
# line.

#-#############################################
# Print The Page Header
#
print "Content-type: text/html\n\n";
print $config{'header'};
#
#-#############################################

local %form = &get_form_data;
if ($form{'action'} eq 'new') { &new; }
elsif ($form{'action'} eq 'repost') { &new; }
elsif ($form{'action'} eq 'procnew') { &procnew; }
elsif ($form{'action'} eq 'procbid') { &procbid; }
elsif ($form{'action'} eq 'reg') { &reg; }
elsif ($form{'action'} eq 'procreg') { &procreg; }
elsif ($form{'action'} eq 'creg') { &creg; }
elsif ($form{'action'} eq 'proccreg') { &proccreg; }
elsif ($form{'action'} eq 'closed') { &viewclosed1; }
elsif ($form{'action'} eq 'closed2') { &viewclosed2; }
elsif ($form{'action'} eq 'closed3') { &viewclosed3; }
elsif ($form{'action'} eq 'admin') { &admin; }
elsif ($form{'action'} eq 'procadmin') { &procadmin; }
elsif ($form{'action'} eq 'search') { &procsearch; }
elsif ($form{'item'} eq int($form{'item'}) and
$category{$form{'category'}}) { &dispitem; }
elsif ($category{$form{'category'}}) { &displist; }
else { &dispcat; }

#-#############################################
# Print The Page Footer
#
print "<P><P ALIGN=CENTER><FONT SIZE=-1><A
HREF=$ENV{'SCRIPT_NAME'}>[Category List]</A>";
print " <A HREF=$ENV{'SCRIPT_NAME'}?action=new>[Post New
Item]</A>" if ($config{'newokay'});
print " <A HREF=$ENV{'SCRIPT_NAME'}?action=reg>[New
Registration]</A> <A
HREF=$ENV{'SCRIPT_NAME'}?action=creg>[Change
Registration]</A>" if ($config{'regdir'});
print " <A HREF=$ENV{'SCRIPT_NAME'}?action=closed>[Closed
Auctions]</A>" if ($config{'regdir'}) and
($config{'closedir'});
print " </FONT></P>\n";
print $config{'footer'};
#
#-#############################################

#-#############################################
# Sub: Display List Of Categories
# This creates a "nice" list of categories.

sub dispcat {
 print "<H2>Auction Categories</H2><TABLE WIDTH=100\%
BORDER=1>\n";
 print "<TR><TD ALIGN=CENTER
BGCOLOR=$config{'colortablehead'}><B>Category</B></TD><TD
ALIGN=CENTER
BGCOLOR=$config{'colortablehead'}><B>Items</B></TD></TR>";
 my $key;
#########################################################################

 foreach $key (sort keys %category) {
  umask(000);  # Does this work on a Mac
#########################################################################

  mkdir("$config{'basepath'}$key", 0777) unless (-d
"$config{'basepath'}$key");
  opendir DIR, "$config{'basepath'}$key" or &oops("Category
directory $key could not be opened.");
  my $numfiles = scalar(grep -T, map
"$config{'basepath'}$key/$_", readdir DIR);
  closedir DIR;
  print "<TR><TD BGCOLOR=$config{'colortablebody'}><A
HREF=$ENV{'SCRIPT_NAME'}\?category=$key>$category{$key}</A></TD><TD
BGCOLOR=$config{'colortablebody'}>$numfiles</TD></TR>";
 }
 print "</TABLE>\n";
}

#-#############################################
# Sub: Display List Of Items
# This creates a "nice" list of items in a
# category.

sub displist {
 print "<H2>$category{$form{'category'}}</H2>\n";
 print "<TABLE BORDER=1 WIDTH=100\%>\n";
 print "<TR><TD ALIGN=CENTER
BGCOLOR=$config{'colortablehead'}><B>Item</B></TD><TD
ALIGN=CENTER
BGCOLOR=$config{'colortablehead'}><B>Closes</B></TD><TD
ALIGN=CENTER BGCOLOR=$config{'colortablehead'}><B>Num
Bids</B></TD><TD ALIGN=CENTER
BGCOLOR=$config{'colortablehead'}><B>High
Bid</B></TD></TR>\n";
 opendir THEDIR, "$config{'basepath'}$form{'category'}" or
&oops("Category directory $form{'category'} could not be
opened.");
 my @allfiles = grep -T, map
"$config{'basepath'}$form{'category'}/$_", sort { int($a)
<=> int($b) } (readdir THEDIR);
 closedir THEDIR;
 my $file;
 foreach $file (@allfiles) {
  $file =~ s/^$config{'basepath'}$form{'category'}\///;
  $file =~ s/\.dat$//;
  my ($title, $reserve, $inc, $desc, $image, @bids) =
&read_item_file($form{'category'},$file);
  if ($title ne '') {
   my ($alias, $email, $bid, $time, $add1, $add2, $add3) =
&read_bid($bids[$#bids]);
   my @closetime = localtime($file);
   $closetime[4]++;
   print "<TR><TD BGCOLOR=$config{'colortablebody'}><A
HREF=$ENV{'SCRIPT_NAME'}\?category=$form{'category'}\&item=$file>$title</A>";

   print " <FONT COLOR=#3333FF SIZE=-1>[PIC]</FONT>" if
($image);
   print "</TD><TD
BGCOLOR=$config{'colortablebody'}>$closetime[4]/$closetime[3]</TD><TD
BGCOLOR=$config{'colortablebody'}>$#bids</TD><TD
BGCOLOR=$config{'colortablebody'}>\$$bid</TD></TR>\n";
  }
 }
 print "</TABLE>\n";
}

#-#############################################
# Sub: Display Item
# This displays a particular item, its
# description, and its associated bids.

sub dispitem {
 my ($title, $reserve, $inc, $desc, $image, @bids) =
&read_item_file($form{'category'},$form{'item'});
 &oops("Item $form{'item'} could not be opened.  If this
item is closed, you can view statistics and bid history
using our <A HREF=$ENV{'SCRIPT_NAME'}\?action=closed>closed
item viewer</A>.") if $title eq '';
 my $nowtime = localtime(time);
 my $closetime = localtime($form{'item'});
 print "<H2>$title</H2><HR><FONT
SIZE=+1><B>Information</B></FONT><HR>\n";
 print "<TABLE WIDTH=100\%><TR>";
 print "<TD BGCOLOR=$config{'colortablebody'}><IMG
SRC=$image></TD>" if ($image);
 print "<TD><TABLE BORDER=1><TR><TD
BGCOLOR=$config{'colortablehead'}><B>$title</B></TD></TR><TR><TD
BGCOLOR=$config{'colortablebody'}><B>Category:</B> <A
HREF=$ENV{'SCRIPT_NAME'}\?category=$form{'category'}>$category{$form{'category'}}</A></TD></TR><TR><TD
BGCOLOR=$config{'colortablebody'}>";
 my ($alias, $email, $bid, $time, $add1, $add2, $add3) =
&read_bid($bids[0]); # read first bid
 print "<B>Offered By:</B> <A
HREF=mailto:$email>$alias</A></TR></TD><TR><TD
BGCOLOR=$config{'colortablebody'}><B>Current Time:</B>
$nowtime</TD></TR><TR><TD
BGCOLOR=$config{'colortablebody'}><B>Closes:</B>
$closetime<BR><FONT SIZE=-2>Or $config{'aftermin'} minutes
after last bid...</FONT></TD></TR><TR><TD
BGCOLOR=$config{'colortablebody'}><B>Number of Bids:</B>
$#bids</TD></TR><TR><TD BGCOLOR=$config{'colortablebody'}>";

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

 my ($alias, $email, $bid, $time, $add1, $add2, $add3) =
&read_bid($bids[$#bids]); # read last bid
################################################################################

 print "<B>Last Bid:</B> \$$bid ";
 print "<FONT SIZE=-1>(reserve price not yet met)</FONT>" if
($bid < $reserve);
 print "<FONT SIZE=-1>(reserve price met)</FONT>" if (($bid
>= $reserve) and ($reserve > 0));
 print "</TD></TR></TABLE></TD></TR></TABLE>\n";
 print "<HR><FONT
SIZE=+1><B>Description</B></FONT><HR>$desc</FONT></FONT></B></I></U></H1></H2></H3></H4></H5>";

 print "<HR><FONT SIZE=+1><B>Bid History</B></FONT><HR>\n";
 my $lowest_new_bid;
 if ($#bids) {
  for (my $i=1; $i<scalar(@bids); $i++) {
   my ($alias, $email, $bid, $time, $add1, $add2, $add3) =
&read_bid($bids[$i]);
   my $bidtime = localtime($time);
   print "<FONT SIZE=-1>$alias \($bidtime\) -
\$$bid</FONT><BR>";
  }
  $lowest_new_bid = &parsebid($bid+$inc);
 }
 else {
  print "<FONT SIZE=-1>No bids yet...</FONT><BR>";
  $lowest_new_bid = (&read_bid($bids[0]))[2];
 }
 # either the item is closed or we will display a bid form
 my ($alias, $email, $bid, $time, $add1, $add2, $add3) =
&read_bid($bids[$#bids]); # read the last bid
 if ((time > int($form{'item'})) && (time > (60 *
$config{'aftermin'} + $time))) {
  print "<FONT SIZE=-1 COLOR=#FF0000><B>BIDDING IS NOW
CLOSED</B></FONT><BR>";
  &closeit($form{'category'},$form{'item'});
 }
 else {
  print <<"EOF";
<FORM ACTION=$ENV{'SCRIPT_NAME'} METHOD=POST>
<HR><FONT SIZE=+1><B>Place A Bid</B></FONT><HR>
<INPUT TYPE=HIDDEN NAME=action VALUE=procbid>
<INPUT TYPE=HIDDEN NAME=ITEM VALUE="$form{'item'}">
<INPUT TYPE=HIDDEN NAME=CATEGORY VALUE="$form{'category'}">
<B>The High Bid Is:</B> \$$bid<BR>
<B>The Lowest You May Bid Is:</B> \$$lowest_new_bid
<P>Please note that by placing a bid you are making a
contract between you and the seller.
Once you place a bid, you may not retract it.  In some
states, it is illegal to win
an auction and not purchase the item.  In other words, if
you don't want to pay for it,
don't 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>
<P><B>Your Handle/Alias:</B> <INPUT NAME=ALIAS TYPE=TEXT
SIZE=30 MAXLENGTH=30> (used to track your bid)
<BR><B>Your Password:</B> <INPUT NAME=PASSWORD TYPE=PASSWORD
SIZE=30> (must be valid)
<BR><B>Your Bid:</B> \$<INPUT NAME=BID TYPE=TEXT SIZE=7
VALUE="$lowest_new_bid"><P>
EOF
  }
  else {
   print <<"EOF";
<P><B>Your Handle/Alias:</B> <INPUT NAME=ALIAS TYPE=TEXT
SIZE=30 MAXLENGTH=30> (used to track your bid)
<BR><B>Your E-Mail Address:</B> <INPUT NAME=EMAIL TYPE=TEXT
SIZE=30> (must be valid)
<BR><B>Your Bid:</B> \$<INPUT NAME=BID TYPE=TEXT SIZE=7
VALUE="$lowest_new_bid">
<P><B>Contact Information:</B> (will be given out only to
the seller)<BR>
<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><P>
EOF
  }
  print <<"EOF";
<INPUT TYPE=SUBMIT VALUE="Place Bid">
EOF
 }
}

#-#############################################
# 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-request@macperl.org