Test::WithTaint - Ensure a Test is run reliably with taint
# re-execute self with tainting t/foo-tainting.t
use Test::WithTaint;
# execute a different script with tainting
use Test::WithTaint -exec => 't/foo.t'This module aims to facilitate taint testing in several ways.
Permit skipping taint-dependent tests in the event a future Perl release lacks taint support
Permit forcing taint mode on a test that is not already running in taint mode
Simplify running the an existing test both in and out of taint mode
Clean up environment when invoking taint-dependent tests to avoid common traps in taint + %ENV
This mode is the most recommended usage, and it adds a layer of safety that is too hard to achieve with a hash-bang trick.
# inside foo.t
use Test::WithTaint;Here, the default behavior is to:
Check your Perl supports tainting, and skip the test if it does not.
Check your Perl is running in taint mode, and continue execution if it is.
In the event Perl is NOT running in taint mode, clean up the environment slightly and re-execute the test under taint mode.
This mode is a variation on SimpleMode designed to reduce code duplication.
# inside foo-tainted.t
use Test::WithTaint -exec => 't/foo.t';This:
Checks Perl supports tainting, and skips the test if it does not.
Cleans up the environment, and Forcefully invokes the test passed to
-execwithexec;
Kent Fredric <kentnl@cpan.org>
This software is copyright (c) 2016 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.