Test::CGI::Untaint - Test CGI::Untaint Local Extraction Handlers |
Test::CGI::Untaint - Test CGI::Untaint Local Extraction Handlers
use Test::More tests => 2; use Test::CGI::Untaint;
# see that 'red' is extracted from 'Red' is_extractable("Red","red","validcolor");
# see that validcolor fails unextractable("tree","validcolor");
The CGI::Untaint module can be extended with ``Local Extraction Handlers'' that can be used define new ways of untainting data.
This module is designed to test these data extraction modules. It does this with the following methods:
# check that "Buffy" is extracted from "Buffy Summers" with # the CGI::Untaint::slayer local extraction handler is_extractable("Buffy Summers","Buffy", "slayer");
# check that nothing is extracted from "Willow Rosenberg" # with the CGI::Untaint::slayer local extraction handler unextractable("Willow Rosenberg", "slayer");
The third argument may optionally contain a name for the test.
is_extractable
does a simple string
equality test, this does a proper deep check like is_deeply
in
Test::More. This is most useful when your class returns a big
old data structure from is_valid rather than a simple scalar.
And that's that all there is to it, apart from the one function that can be used to configure the test suite. It's not exported by default (though you may optionally import it if you want.)
use Test::CGI::Untaint qw(:all); config_vars({ INCLUDE_PATH => "Profero" });
None known.
Bugs (and requests for new features) can be reported to the open source development team at Profero though the CPAN RT system: http://rt.cpan.org/NoAuth/ReportBug.html
Written By Mark Fowler <mark@twoshortplanks.com>.
Copyright Profero 2003
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
the Test::More manpage, the CGI::Untaint manpage
Test::CGI::Untaint - Test CGI::Untaint Local Extraction Handlers |