You were looking for chmod. What you weren't looking for but still need is a general critique of whatever it is that you're doing. Unfortunately you didn't provide enough information to be helpful for this concern. The long and short of it is that your proposition scares the begeezus out of me. I'm very concerned that you either aren't going to take the nessessary care to do this safely or that you aren't aware of all the issues. Would you post more about what you're doing that requires you to create new executables?


Added: I reviewed your posting history and I'm guessing that you are writing some sort of game. Perhaps as a means for learning perl. If so bravo! Doubleplus bravo for find perlmonks.org, hanging around and asking questions. At this point I'm primarily concerned with two issues - malicious code injection and file locking. The first one is why I started this response in the place.

I don't know how you are generating the contents of these scripts or what their filenames are but you must be particularly careful to prevent user-supplied data from getting into these. Where it's not possible to prevent user-supplied data from going here you must be extra vigilant that it's vetted to be ok. This is where perlsec and taint becomes your friend. Once you've assured yourself of those requirements then you need to start looking at file locking. Your use of open(FILE,'>file.txt') is prone to clobbering and loss of data.

If you start posting your code then you can get some actually helpful help. Mostly this response just exists to let you know that there are serious problems with your approach and that I'd like to help but don't have enough information.


Seeking Green geeks in Minnesota


In reply to Re: Creating .cgi Scripts On the fly by diotalevi
in thread Creating .cgi Scripts On the fly by ACJavascript

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.