Definition and use of recursive sub in Mojo template #1656
-
I have a template which renders a directory tree. A separate module scans the disk and builds a hash-based tree structure which represents the structure of directories and sub-directories. (It also counts the images in each directory but that's not relevant here). The structure which that module returns is of this form
Of course I can't tell how deep the tree goes, so to generate the HTML to display it I need a recursive function. Following https://stackoverflow.com/questions/26254966/creating-recursive-template-blocks-in-mojolicious I coded this (omitting a few lines for brevity)
But running it under morbo I get That Stack Exchange article is over 6 years old: has something changed since then to invalidate my code? What am I doing wrongly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think you're rendering |
Beta Was this translation helpful? Give feedback.
I think you're rendering
use v5.16;
to the client rather than using it as a directive. Put a % in front of that line. If that doesn't fix it, put% use feature 'current_sub';
on the second line