Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error - but where? 1

Status
Not open for further replies.

serpento

Programmer
Jun 16, 2002
92
GB
The code bellow was working fine until I changed something by mistake and suddenly it says only this when I try to run it:

Warning: Content-Type header not found in the script output. If this script is not a CGI one, please use the Run -> Run in Command Prompt menu to run it.
Execution of index.pl aborted due to compilation errors

So I did a "syntax check" on it and can't work out where the syntax error is. The results from the syntax check are:

Missing right curly or square bracket at index.pl line 150, at end of line
(Might be a runaway multi-line << string starting on line 136)
syntax error at index.pl line 150, at EOF
index.pl had compilation errors.

Please help as I have spent ages trying to wprk out where the error is but really can't! Its probably really simple.

Code:
#!/usr/bin/perl
use CGI;
require ('../usefulSubs.pl');

#### Prepare table format ####

$tableHighlighted = <<'SINGLE_QUOTES';
  <TR>
    <TD width="80" background="../images/tableFadeLeft.gif">
      ¦tableDate¦
    <TD width="350" bgcolor="#FFFFFF">
      ¦tableTitle¦
    <TD width="200" background="../images/tableFadeRight.gif">
      ¦tableCatagories¦
SINGLE_QUOTES

$tableNormal = <<'SINGLE_QUOTES';
  <TR>
    <TD>
      ¦tableDate¦
    <TD>
      ¦tableTitle¦
    <TD>
      ¦tableCatagories¦
SINGLE_QUOTES

#### Read in dreams ####

foreach $entry (getDir('leesDreams'))
{
  if (fromLast('.', $entry) eq 'ftm')
  {
    $dateofDream = uptoFirst('_', $entry);
    push (@tableOfDreams, forge($dateofDream, "\n", getFile("leesDreams/$entry")));
  }
}

#### See which dream to go from and prepare table data ####

$dreamsFrom = getCookie('dreamsFrom');
if (!$dreamsFrom) {$dreamsFrom = 1;}

$rowType = "highlighted";
foreach $dream ("<B>Date:</B>\n<B>Title:</B>\n<B>Categories:</B>", @tableOfDreams)
{
  @dataCells = split("\n", $dream);
  $tableDate = shift(@dataCells);
  $tableTitle = shift(@dataCells);
  $tableCatagories = shift(@dataCells);
  $dreamNumber++;

  if ($dreamNumber >= $dreamsFrom && $dreamNumber <= $dreamsFrom+17)
  {
    if ($rowType eq "highlighted")
    {
      $tableData = forge($tableData, replaceVars($tableHighlighted));
      $rowType = "normal";
    }
    else
    {
      $tableData = forge($tableData, replaceVars($tableNormal));
      $rowType = "highlighted";
    }
  }
}

#### Prepare option menu ####

$topPart = <<'SINGLE_QUOTES';
  <FORM name="form¦formNum¦" onSubmit="document.location='index.stm?'+form¦formNum¦.viewDream.value; return false;">
    View:
    <SELECT name="whichDreams">
      <OPTION>Lee's Dreams</OPTION>
      <OPTION>Guests' Dreams</OPTION>
      <OPTION>All Dreams</OPTION>
    </SELECT>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    Sort by:
    <SELECT name="sortBy">
      <OPTION>Newest First</OPTION>
      <OPTION>Oldest First</OPTION>
      <OPTION>A - Z</OPTION>
      <OPTION>Z - A</OPTION>
    </SELECT>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    Catagory:
    <SELECT name="catagory">
      <OPTION>All Categories</OPTION>
      <OPTION>Friends</OPTION>
      <OPTION>Trapped</OPTION>
      <OPTION>School</OPTION>
      <OPTION>Jumping</OPTION>
      <OPTION>Imagination</OPTION>
      <OPTION>Hovering</OPTION>
      <OPTION>Woodcraft</OPTION>
      <OPTION>Cannabis</OPTION>
      <OPTION>Claustraphobia</OPTION>
    </SELECT>
SINGLE_QUOTES

#### Prepare navigator ####

if ($dreamsFrom != 1)
{
  $previousPage = <<'SINGLE_QUOTES';
    <A href="." onclick="viewDreamsFrom(18);">
      << Previous Page
    </A>
  SINGLE_QUOTES
}

if ($dreamsFrom > @tableOfDreams)
{
  $nextPage = <<'SINGLE_QUOTES';
    <A href="index.stm?3">
      Next Page >>
    </A>
  SINGLE_QUOTES
}

$navigator = <<'SINGLE_QUOTES';
    ¦previousPage¦
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    ¦nextPage¦
SINGLE_QUOTES

$formNum = 2; $bottomPart = replaceVars(forge('<BR>', $navigator, '<BR><BR>', $topPart, '</FORM><BR>'));
$formNum = 1; $topPart = replaceVars(forge('<BR>', $topPart, '<BR><BR>', $navigator, '</FORM>'));

#### Print it all ####

print <<DOUBLE_QUOTES;
<CENTER>
  <SCRIPT language="javaScript">
    function viewDreamsFrom(dreamsFrom)
    {
      document.cookie='dreamsFrom=' + dreamsFrom + ';path=/';
    }
  </SCRIPT>
  $topPart
  <TABLE cellpadding="5" cellspacing="0" border="0" style="width:630px">
    $tableData
  </TABLE>
  $bottomPart
</CENTER>
DOUBLE_QUOTES

-Ed ;-)

________________________________
Destiny is not a matter of chance; it is a matter of choice.
 
Hello Ed,

I had to scratch my head as well, but you were right - something simple.

Make sure that the lines containing the token SINGLE_QUOTES don't start with spaces, SINGLE_QUOTES should be the first thing on the line.

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Hi Mike,

Thanks loads, your help is much apprecited as it has solved my problem perfectly. I won't be making that mistake again!

Have a star.

-Ed ;-)

________________________________
Destiny is not a matter of chance; it is a matter of choice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top