Help for this page

Select Code to Download


  1. or download this
    $allowed{action} = 'post|edit|delete|long|short';
    $query->{action} eq "post"
    ...
      return 0 if $query->{$key}!~/$allowed{$key}/;
      1;
    }
    
  2. or download this
    # Map keys to coderefs (used sort of like a switch statement)
    my %ActionMap =
    ...
    for my $key (keys %$query){
      return 0 unless exists $allowed{$key} && $query->{$key} =~ /$allowed
    +{$key}/;
    }