#!/usr/bin/speedy -wT use strict; use CGI::Simple; use MyApp::Theme; use vars qw/$q/; $q = new CGI::Simple; warn $q->Dump; if ($q->param('theme') =~ m#([\w\-:(){} /]+)#) { my $theme = $1; my @themes = map {$_->theme} MyApp::Theme->search_like(theme => $theme."%"); my %matches; foreach (@themes) { my $nextslash = index($_, " / ", length $theme); if ($nextslash == -1) { # not found - it's a leaf $matches{$_} = $_; } elsif (not exists $matches{$_}) { substr($_, $nextslash) = ""; $matches{$_} = "$_ / "; } } print $q->header; print ""; }