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
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |