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

problems with a perl section



Obviously I'm doing something wrong, but I don't know what.

As I understand it, programming construct expansion is done in pass 3,
and is done before such tags as <grid> and <cell> are translated.

So, I'm  trying to interactively  generate a table with  layout=XxY by
defining X and Y at the command line (using -D X=5 -D Y=4)

This is the perl section I am using:

<perl>
  $cells=<:=$X:>*<:=$Y:>;
  print("<grid layout=\"<:=$X:>x<:=$Y:>\" padding=\"3\" spacing=\"3\" align=\"c\">\n");

  for ($i=1; $i <= $cells; $i++) {
    $img = sprintf("%02d.jpg", $i);
    print ("<cell><href=\".images\/$img\" src=\".thumbs/t-$img\"></a></cell>\n");
  }

  print "<\/grid>\n";
</perl>

I know it's ugly as sin, but I'm hoping for something flexible.

I keep getting this:

$ wml -o index.html -D X=5 -D Y=3 gallery.wml
ePerl:Error: Perl parsing error (interpreter rc=255)

---- Contents of STDERR channel: ---------
Unterminated <> operator at gallery.wml line 20.
------------------------------------------
** WML:Break: Error in Pass 3 (rc=74).

It looks like it's mixing the variable '<>' brackets up, but I've
tried the following replacement:

<perl>
  $cols=<:=$X:>;
  $rows=<:=$Y:>;
  $cells=($cols * $rows);

  print("<grid layout=\"" . $cols . "x" . $rows . "\" padding=\"3\"
spacing=\"3\" align=\"c\">\n");

. . .

Which gives the same error (even the line #).

Any ideas what I'm missing?  I've looked at the docs, and I know pass
3 expands the <:=$var:> constructs, so it seems to me that the above
code should work.

TIA
Lou
-- 
Louis LeBlanc               leblanc@keyslapper.org
Fully Funded Hobbyist, KeySlapper Extrordinaire :)
http://www.keyslapper.org                     ԿԬ

Nondeterminism means never having to say you are wrong.
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com