With Perl 5.8.0, a new special variable has been introduced, ${^TAINT}, which indicates whether taint mode is enabled - See perldelta. The following little block of code has been written to show how this variable may be of used to ensure the application of taint mode with code which may accept potentially dangerous input from outside of the codebase.

Moreover, I wanted to write a piece of code that mandated the requirement of taint mode where the lexical term 'use Taint' was employed. Subsequently, I wasn't sure if this post rightly belonged in Meditations or Poetry :-)

package Taint; require 5.8.0; use Carp; croak( 'Code execution called without -T (taint) switch' ) unless ${^T +AINT}; 1; __END__

And in usage ...

kathmandu:/home/development/perl-5.8.0# ./bin/perl5.8.0 -e 'use Taint' Code execution called without -T (taint) switch at -e line 1 Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1. kathmandu:/home/development/perl-5.8.0# ./bin/perl5.8.0 -T -e 'use Tai +nt' kathmandu:/home/development/perl-5.8.0#

 

perl -e 'print+unpack("N",pack("B32","00000000000000000000000111101101")),"\n"'


In reply to [5.8.0 Note] use Taint or die by rob_au

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.