I cannot reproduce your problem. The code you posted simply does not work. I added some required lines:

#!/usr/bin/perl -T use strict; use warnings; use File::Spec; use File::Temp qw( tempdir ); my $pathdir = $ENV{HOME}; (-d $pathdir) and File::Spec->file_name_is_absolute($pathdir); my $workdir = tempdir("temp.XXXXXX", DIR => "log");

Running that with taint mode, i.e. perl -T perlmonks.pl, creates the following error:

$ perl -T perlmonks.pl Error in tempdir() using log/temp.XXXXXX: Parent directory (log) does +not exist at perlmonks.pl line 10. $

After creating the missing directory, there are no more errors or warnings:

$ mkdir log $ perl -T perlmonks.pl $

Please post a Short, Self-Contained, Correct Example.


Generally, taint errors indicate that you have used data from outside Perl (i.e. environment, command line parameters, file contents) without a formal validation. See Re: When not to use taint mode for what taint mode actually does. It is pretty simple, not much more than a flag on a value that is hard to remove, "infects" other values with most operations, and causes a crash when a flagged ("tainted") value passed to selected functions.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re: Revisiting Insecure dependency in mkdir while running with -T switch at ... File/Temp.pm line 542 by afoken
in thread Revisiting Insecure dependency in mkdir while running with -T switch at ... File/Temp.pm line 542 by sidney

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.