sub cgi2args { my $cgi = shift; #my $cgi = CGI->new('a.b.c=3&a.b.c=4&x.y=4'); # a & a.b ? warn my $args = {}; for my $name ($cgi->param) { # could warn unrecognized for html typos #for my $name (grep $interface_re, $cgi->param) { my @segments = split /\./, $name; my $last_seg = pop @segments; my $a = $args; for (@segments) { $a->{$_} ||= {}; # XXX defined not true $a = $a->{$_}; } my @values = $cgi->param($name); $a->{$last_seg} = @values == 1 ? $values[0] : \@values; } return $args; }