CatalystX-Menu-Tree

 view release on metacpan or  search on metacpan

lib/CatalystX/Menu/Tree.pm  view on Meta::CPAN

        map { [ $_->{menupath}, $_ ] }
        @data;

    my %tree;

    for my $obj (@sorted) {
        my $mpath = $obj->[1]{menupath};
        my $mtitle = $obj->[1]{menutitle} || '';
        $mpath =~ s!^/!!;
        my $uri = $obj->[1]{uri};
        my @path = split m!/!, $mpath;
        my $str = join ', ' => @path;
        my $node = pop @path;
        my $ref = \%tree;
        while (@path) {
            my $key = shift @path;
            if (exists $ref->{$key}) {
                unless (exists $ref->{$key}{children}) {
                    $ref->{$key}{children} = {};
                }
                $ref = $ref->{$key}{children};



( run in 0.675 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )