CGI::Untaint::boolean - untaint boolean values from CGI programs


CGI-Untaint-boolean documentation  | view source Contained in the CGI-Untaint-boolean distribution.

Index


NAME

Top

CGI::Untaint::boolean - untaint boolean values from CGI programs

SYNOPSIS

Top

  use CGI::Untaint;

  my $handler = CGI::Untaint->new( $q->Vars() );
  my $boolean = $handler->extract( -as_boolean => 'some_feature' );

DESCRIPTION

Top

This input handler verifies that it is dealing with a reasonable boolean value, probably from a checkbox with no value specified. In this case, "reasonable" means that the value is on, if the checkbox is checked, or empty, if the client did not send a value.

Note: the value() method will return either true or false. It will not return the string "on" or the empty string. It's boolean for a reason! (Don't count on it returning 0 for false either; false is just false.)

METHOD

Top

is_valid()

Returns true if the value for this checkbox is valid, setting the value to true if the value is on, false otherwise.

SEE ALSO

Top

CGI::Untaint, CGI::Untaint::object

AUTHOR

Top

chromatic, chromatic at wgz dot org

Thanks to Tony Bowden for helpful suggestions, Simon Wilcox for reporting a false value bug, with a test patch, and Dave Wilcox for helping to disambiguate the documentation.

BUGS

Top

No known bugs. Please report any to http://rt.cpan.org/.

COPYRIGHT

Top


CGI-Untaint-boolean documentation  | view source Contained in the CGI-Untaint-boolean distribution.