Stories
Slash Boxes
Comments

Slash Open Source Project

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login
Loading... please wait.
  • [slash@yaz slash]$ perl -MSlash::Test -leDisplay
    [%
    digits = [ 0 .. 9 ];
    anumber = digits.rand _ digits.rand _ digits.rand;
    anumber;
    %]
    ^D
    769
    Note a few things:
    • _ is the concatenation operator in Template Toolkit (I don't recall when it was added, so test first before you use it).
    • The range operator (..) works in Template Toolkit.
    • rand() is a custom scalar op in Slash; it is not provided by Template Toolkit by default, last I checked.
    • Slash::Test is your friend!

    • [Thu Jun 27 15:56:02 2002] [error] /article.pl:Slash:/usr/local/lib/perl5/sit e_per
      l/5.6.1/i686-linux/Slash.pm:845:ID 4, header;misc;default : file error - parse err
      or: 4 line 2-6: unexpected token (dig)
          [% var dig = [ 0 .. 9 ];
      anumber = dig.rand _ dig.rand _ dig.rand;
      anumber; %]
      Any ideas why I get this.... From reading the TemplateToolkit docs pudge's solution looks like it should work.

      [Thu Jun 27 15:56:02 2002] [error] Which was called by:Apache::ROOTnews_2ediverseb
      ooks_2ecom::articl e_2epl
      --
      http://news.DiverseBooks.com/ SF and Computing Book News
      • by alexmc (524) on Thursday June 27 2002, @11:07AM (#5040) Homepage
        Oh, I stuck in a "var" to see if that would help. I get the same message with and without the var, and yes I have restarted apache :-)
        --
        http://news.DiverseBooks.com/ SF and Computing Book News