#!/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 ""; } #### $VAR1 = bless( { '.parameters' => [ 'theme', '_' ], '.globals' => { 'DEBUG' => '0', 'NO_UNDEF_PARAMS' => '0', 'NO_NULL' => 1, 'FATAL' => -1, 'USE_PARAM_SEMICOLONS' => '0', 'DISABLE_UPLOADS' => 1, 'USE_CGI_PM_DEFAULTS' => '0', 'NPH' => '0', 'POST_MAX' => 102400, 'HEADERS_ONCE' => '0' }, '.fieldnames' => { '_' => 1, 'theme' => 1 }, '_' => [ '' ], 'theme' => [ 'Some value' ] }, 'CGI::Simple' ); at /var/www/cgi-bin/ac_theme line 16. #### $VAR1 = bless( { '.globals' => { 'DEBUG' => '0', 'NO_UNDEF_PARAMS' => '0', 'NO_NULL' => 1, 'FATAL' => -1, 'USE_PARAM_SEMICOLONS' => '0', 'DISABLE_UPLOADS' => 1, 'USE_CGI_PM_DEFAULTS' => '0', 'NPH' => '0', 'POST_MAX' => 102400, 'HEADERS_ONCE' => '0' }, '.cgi_error' => '500 Bad read on POST! wanted 48, got 0' }, 'CGI::Simple' ); at /var/www/cgi-bin/ac_theme line 16.