Hi,

Can you give a little more information? I'm not sure why you want world to be able to execute or write to a file that is still being written?

Thanks,
Smaug.
Update:
Try:
sysopen(FILEHANDLE, $filename, permissions, CHMOD);

Just another update:
Based on reasonablekeith comments I decided to try some tests. I ran the following code:
#!/usr/bin/perl use strict; use Fcntl; my $var = 1; while ($var) { sysopen (FILE, '/home/smaug/testing/file.txt', O_RDWR|O_EXCL|O_CRE +AT, 0777); printf FILE "A value of n\n"; } close (FILE);


This, of course, opens the file and keeps it open for reading, writing and executing...... or so it would seem. However an "ls -l" shows the following:
-rwxr-xr-x 1 root root 13 2006-11-21 11:55 file.txt

In short, sysopen calls the underlying operating system's open function. On my OS (Ubuntu Linux) the OS prevents writing to files that are already open for writing, so it seems that although it is still executable (why oh why!!) it is not writable.
(The same is shown by trying to open the same file twice using "vi".)
Again, looks can be deceiving... Trying to run the file while it is written shows:
bash: ./file.txt: Text file busy
Perhaps there are other OS's out there that allow this, but for now - I'm going with the "Cannot be done" answer.
Thanks for pricking my curiosity reasonablekeith.

In reply to Re: Creating file with 777 permission by Smaug
in thread Creating file with 777 permission by Anonymous Monk

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.