Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

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 | Reply
Loading... please wait.
  • brian d foy's Tie::Cycle is ideal for this, although I'm not sure how it'll fit into TT. Maybe I'll write a plugin wrapper for it.
    --

    --
    xoa

    • Oh look, it seems to already exist: Template::Plugin::Cycle [cpan.org]
      --

      --
      xoa

      • That isn't actually based on Tie::Cycle, it's a complete new reimplementation of the functionality.

        Also it's not a properly written TT plugin. It doesn't inherit from Template::Plugin so you can't use it from a template like this:

        [% USE Cycle('foo', 'bar') -%]
        [% Cycle %]
        [% Cycle %]
        [% Cycle %]

        If you replace Cycle.pm with the version that you'll find at http://dave.org.uk/template/ then it will work as expected.

        $ tpage test.tt
        foo
        bar
        foo

        I'll submit the patch to the author tonight.

        • I don't mind if it's based on Tie::Cycle or not. I just want the functionality.

          Thanks for the patch. I hope Adam can crank it out soon. I wasn't too keen on having to pass in an iterator in the process() call.

          --

          --
          xoa