Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!perl -T use strict; # !!!IN DEVELOPMENT ONLY!!! use warnings; # !!!IN DEVELOPMENT ONLY!!!

Good Lord! If you remove strict and warnings once this is in development then your script maintainer might forget about good programming practices later and do terrible things! I'd recommend leaving them in, even in production code.

As for why you have to untaint $userfile before you're allowed to write to it, I think you might want to look at these two lines:

sub CONFIG() { '../data/conf/site.conf' } my $config = do( CONFIG );
If your ../data/conf/site.conf file contains insecure data or anything that taint ought to object to, this will fail. For example if your conf script returns "$ENV{PATH}/userdirectories" (as it's last line) then $config will be tainted and when combined with the previously clean $param{username} will taint $userfile.

It would be sensible to untaint $config data too, just in case it changes. :) Nice code overall though. :)


Update: Just read your Update and realised that you're right, it's not your configuration data. Did a few more tests and have decided that the problem is with taint not liking precompiled regular expressions. It all works as you'd expect if you replace your expressions with ordinary regular expressions. Unfortunately this sort of ruins the point. Any other suggestions monks?

I also missed a question. Yes, that's a good use of ref.

In reply to Re: proper untainting and use of ref by jarich
in thread proper untainting and use of ref by particle

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2023-03-31 15:07 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (76 votes). Check out past polls.