Perl CGI giving error while using Taint when uploading a file:

Insecure dependency in sysopen while running with -T switch at C:/Perl/site/lib/File/Temp.pm line 512.

Script works fine when Taint is not used in the shebang line. Error when Taint is on.
#!C:/Perl/bin/perl.EXE -wT # CGI program to check Taint problem while uploading file. It prompts # for the of the file to be uploaded and displays the name of the # uploaded file. # Tested in: # OS Windows-7 32 bit, Perl 5.22.3, Apache 2.2 # OS WindowsServer-2012 64 bit, Perl 5.24.2, Apache 2.4.20 # OS Centos-6.10 64 bit, Perl 5.26.1, Apache 2.2.15 use strict; use warnings; use CGI; use CGI::Carp qw (fatalsToBrowser warningsToBrowser); my $q = new CGI; my $p_upl_new_file = $q->param ("p_upl_new_file") || ''; &sPrintForm; exit; ################################################################### sub sPrintForm { print $q->header (); print $q->start_html (); print $q->start_form ({-name => "form1"}); print $q->h1 ({-align => "center"} , "File Upload Test"); print "<br><br>"; print $q->filefield (-name => 'p_upl_new_file'); print "<br><br>"; print $q->submit (-name => "action_submit" , -value => "Submit"); print "<br><br>"; print "File name $p_upl_new_file"; print $q->end_form; print $q->end_html; } # END #############################################################

In reply to Taint error on file upload by Sanjay

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.