G'day ksublondie,

What you've presented in your OP has all sorts of problems. Look at deleted @ENV{...): that should be delete not deleted; and the right parenthesis should be a right brace. You've also linked to Printer. The source code for that Module is quite different from what you've posted (as "the code for Printer is"): it has use Env qw(PATH), not the syntactically incorrect code you show (')' instead of '}' again); it also has no code which matches open PRINTER!

The upshot of this is that we don't know what code you're really running, nor what module you're really using. As I'm sure you'll realise, this makes it difficult to help you.

use, and sub definitions, occur at compile time. Your modification of $ENV{PATH} occurs at runtime. I suspect your problem is related to this.

Your taint error is most often caused by a PATH ending with ':.'; although, any relative pathname could be the problem. There could be other reasons, too. I suggest you put code like the following at the very start of your program; immediately following the shebang line would probably be best.

#!/usr/bin/env perl -T use strict; use warnings; BEGIN { use File::Spec; # To avoid "Insecure $ENV{PATH} while running with -T switch" $ENV{PATH} = join ':', grep { File::Spec::->file_name_is_absolute( +$_) } split /:/, $ENV{PATH}; # To ensure there's no dependency on these potentially insecure va +riables delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; }

In case you didn't know, BEGIN occurs at compile time. By putting this code first, %ENV is modified before any other compile time actions.

If you copy and paste code, you won't end up with the typographical errors (probably caused, at least in part, by entering by hand) that your OP has in multiple places. Also, please check that all links actually link to the indicated information, and any references accurately reflect the sources you provide.

Update: Minor typo fix: s/you program/your program/

— Ken


In reply to Re: Taint error in Printer module by kcott
in thread Taint error in Printer module by ksublondie

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.