Help for this page

Select Code to Download


  1. or download this
    if ($checks{'data'} =~ /([^$checks{'regex'}])/) {
        bail_out("Bad input.");
    }
    
  2. or download this
    if (defined $checks{'value'}) {
        if (ref $checks{'value'} eq 'Regexp') {
    ...
                unless ($checks{'data'} eq $checks{'value'});
        }
    }
    
  3. or download this
    $email_address = sanitize(
      data        => param('email'),
    ...
      max         => 4,
      value       => qr/^(?:red|green|blue)$/,
    );
    
  4. or download this
    $username = sanitize(
      data        => param('username'),
    ...
      max         => 8,
      value       => qr/^[%;&()#\w ]+$/,
    );
    
  5. or download this
    $autosave = sanitize(
      data        => param('autosave'),
    ...
      max         => 2,
      value       => 'on', # not a regular expression; $checks{'data'} mus
    +t eq "on"
    );