All aspects of the navigation structure syntax have now been covered. Suggestions and comments welcome. The recursion code is convoluted and should be abstracted out. Some of the subroutines are way too long. Maybe it would be cleaner to do output in two passes - one for parsing the navigation structure, and one for doing the output.
Recursion is currently depth-first only.
This would mean some major changes though, as the structure is currently described as an arrayref, not a hashref, so as to preserve ordering. If the structure parsing phase was separated out, that would make this a lot easier. This has to be optional, because it would mean that any coderefs given to dynamically generate menu items would have to be run here, which is bad if your coderefs point to expensive code. Debugging isn't tested. But then that's kind of the point.