/edit?items=[(\w+)];location=(\w+);flags={(\d+)};... { if ( $arg->{location} eq 'US' ) { for my $item ( @{$arg->{items}} ) { if ( $arg->{flags}{54} ) { $r->print "item: $item qualifies for discount 54 processing
\n"; } } } # other optional args that we may / may not have if ( defined $arg->{style} ) { $r->print("you have style! $arg->{style}
\n" } }; # args are placed in hashref $arg # [] indicates that the named arg should be an array. # {} indicates that the named arg should be a hash. # for a URL of flags=54&flags=23&flags=red # might yeild # $arg->{flags} = { # 54 => 54, # 23 => 23, # red => 'red', # }; # so that programmers can use keys values as they are comfy? # optional args (ie the ...) are available in $arg #### :DESPATCH /edit?node=(\w+);... { print "You're trying to edit '$node'"; }; :PARAM node { my ( $node ) = @_; my $db = My::Database->new(...); return $node if $db->selectValue( sql => "select count(*) from nodes where node=?", param => [$node] ); print "invalid node: $node"; return undef; } #### /edit?name=(\w+);city=(\w+);... { print "Edit '$name' in '$city'"; }; /edit?name=(\w+);job=(.*);... { print "Edit '$name' who does '$job'"; };