Slash Boxes

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.
More | Login
Loading... please wait.
  • by pudge (6) on Tuesday June 18 2002, @11:58AM (#5016) Homepage
    [slash@yaz slash]$ perl -MSlash::Test -leDisplay
    digits = [ 0 .. 9 ];
    anumber = digits.rand _ digits.rand _ digits.rand;
    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!
    • I don't have Slash::Test :-(
      -- SF and Computing Book News
      • Slash::Test comes with the latest supported Slash release, 2.2.5. If you are using 2.0.x, well, then I don't think you can use it, but I am not sure, since I don't recall much about 2.0.x.

    • [Thu Jun 27 15:56:02 2002] [error] / e_per
      l/5.6.1/i686-linux/ 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
      -- SF and Computing Book News
      • 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 :-)
        -- SF and Computing Book News
      • "var dig"? Surely you mean "dig".
        • I was getting pretty desperate and threw in a "var" on the off chance that it introduced a variable. It didn't make any difference. The example I gave has the same problem without the "var"
 SF and Computing Book News