in reply to Rendering a hierarchical data-structure as html

What you probably want to do is a recursive print of the objects. Something like (total pseudo-code)-

sub dump_tree { my $thing = shift; print "<div>"; dump_tree($_) for $thing->kids; print $thing if $thing->is_printable; print "</div>"; }

And then your CSS basically takes care of itself. And you can do things like this-

/* Take these as deep as you need/want and apply.class */ div { background-color: #111; } div>div { background-color: #611; } div>div>div{ background-color: #161; } div>div>div>div { background-color: #116; }

Sadly, you can't recurse += with the CSS but you could certainly write the CSS with Perl to go as deep as you like/need and manipulate the layout variables programmatically/progressively.

.