0

My ISP - upgraded the Apache servers and in doing so - the CGI/Perl script below that worked before since they didn't require use strict now does not - since I uncommented out the use strict - I'm getting two errors - at first I was getting: Global symbol "@allgifs" requires explicit package name errors for each of my variables - which went away once I added these lines:
my allgifs;
my row;
my col;
my imagemap;
my item;
my topLeftX;
my topLeftY;
my bottomRightX;
my bottomRightY;

Now I am getting No such class allgifs for each of my variables - which I'm not sure how to remedy.

Here is the full code:

#!/usr/bin/perl5 -wT
#use strict;
#use warnings;
#use CGI qw(:standard);

#require "cgi-lib.pl";

use strict;
use warnings;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
require "cgi-lib.pl";

my allgifs;
my row;
my col;
my imagemap;
my item;
my topLeftX;
my topLeftY;
my bottomRightX;
my bottomRightY;

opendir THISDIR, "smallClocks";
@allgifs = grep !/^\.\.?$/, readdir THISDIR;
closedir THISDIR;
#@allgifs = reverse @allgifs;

$row = 0;
$col = 0;

$imagemap  = "<MAP NAME=\"pictureTable\">\n";
foreach $item(@allgifs) {

    $item =~ s/.gif//gi;

    $topLeftX     = ($col*36);
    $topLeftY     = ($row*50);
    $bottomRightX = ($col*36) + 32;
    $bottomRightY = ($row*50) + 32;
    $imagemap .= "<AREA SHAPE=\"rect\" COORDS=\"$topLeftX,$topLeftY,$bottomRightX,$bottomRightY\" HREF=\"cgi-bin/2.cgi?id=$item\">\n";
    $col = $col+1;
    if ($col == 6) {
    $row=($row+1);
    $col=0;
    }
}
$imagemap .= "</MAP>\n";

# Do some HTML
print &PrintHeader;
print << "EndOfHTML";
<HTML>
<HEAD>
<BASE HREF="http://www.mysite.com/">
<TITLE>Mysite Image Display</TITLE>
$imagemap
</HEAD>
<BODY BGCOLOR="#FFFFFF" BACKGROUND="images/yellowBarBG.gif" LINK="#000000" ALINK="#BB0000" VLINK="#000000">
<TABLE BORDER=0 WIDTH=600>
<TR VALIGN=TOP>
  <TD WIDTH=150 ALIGN=LEFT>
<CENTER>
<FONT SIZE=1>mysite<BR>image builder</FONT><BR>
<U><B>S T E P &nbsp; O N E</B></U><BR>
<FONT SIZE=2>
<FONT COLOR="blue"><I>CHOOSE A DESIGN</I></FONT><BR><BR>
</CENTER>
To begin the image creation process, select one of the designs to the right by clicking on the desired thumbnail image.
<BR><BR>
<FONT COLOR="green">At the end of the builder process you will view a larger image of your image.</FONT>
<BR><BR>
If you would first like to browse and view larger versions of the images,
please visit the <A HREF="/cgi-bin/selectedimages.cgi">Selected Images</A> section.
<BR><BR><BR>
<CENTER>
<A HREF="./">return to front page</A>
<BR><BR><BR>
<IMG SRC="images/card.gif" USEMAP="#mail.eye" BORDER=0>

<MAP NAME="mail.eye">

<AREA SHAPE=RECT COORDS="8, 81,142, 112" HREF="mailto:mail\@mysite.com ">

</MAP>
</CENTER>
</FONT>
</TD>
  <TD WIDTH=50>&nbsp;&nbsp;</TD>
  <TD WIDTH=400>
<img src="cgi-bin/pictureTable.cgi" border="0" usemap="#pictureTable">
  </TD>
</TR>
</TABLE>
</BODY>
</HTML>
EndOfHTML

Edited by koneill: Added text

2
Contributors
2
Replies
15
Views
7 Months
Discussion Span
Last Post by koneill
0

For this I take this is Perl code and read http://perldoc.perl.org/perlvar.html as a refresher.

On line 14 you called out allgifs as a variable.
Later it seems you added @ and that would be an array.
Maybe it's just a matter of line 14 defining what it actually is.

Me? No way a Perl expert.

0

I got through the error by setting the array/variables as such:

my @allgifs;
my $row;
my $col;
my $imagemap;
my $item;
my $topLeftX;
my $topLeftY;
my $bottomRightX;
my $bottomRightY;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.