Professional Web Applications Themes

file opening - Perl / CGI

j <john62electronmail.com> wrote: > is there some way to try to open a file in perl such that it will > fail if the file exists? $ perldoc -f sysopen You'd need the O_CREAT and O_EXCL flags, something like: sysopen(FH, $path, O_WRONLY|O_CREAT|O_EXCL) or die "sysopen: $path: $!"; -- Steve...

  1. #1

    Default Re: file opening

    j <john62electronmail.com> wrote:
    > is there some way to try to open a file in perl such that it will
    > fail if the file exists?
    $ perldoc -f sysopen

    You'd need the O_CREAT and O_EXCL flags, something like:

    sysopen(FH, $path, O_WRONLY|O_CREAT|O_EXCL)
    or die "sysopen: $path: $!";

    --
    Steve
    grazz@pobox.com Guest

  2. #2

    Default Re: file opening

    [email]grazzpobox.com[/email] wrote:
    > j <john62electronmail.com> wrote:
    >> is there some way to try to open a file in perl such that it will
    >> fail if the file exists?
    > $ perldoc -f sysopen
    > You'd need the O_CREAT and O_EXCL flags, something like:
    > sysopen(FH, $path, O_WRONLY|O_CREAT|O_EXCL)
    > or die "sysopen: $path: $!";
    Note that this depends entirely on the cooperation of the OS and the
    filesystem. This is almost always guaranteed to work on a local
    filesystem of a UNIX machine. It is not guaranteed to work over NFS.

    --
    Darren Dunham [email]ddunhamtaos.com[/email]
    Unix System Administrator Taos - The SysAdmin Company
    Got some Dr Pepper? San Francisco, CA bay area
    < This line left intentionally blank to confuse you. >
    Darren Dunham Guest

  3. #3

    Default Re: file opening

    Darren Dunham <ddunhamredwood.taos.com> wrote:
    > [email]grazzpobox.com[/email] wrote:
    > > j <john62electronmail.com> wrote:
    > >> is there some way to try to open a file in perl such that it will
    > >> fail if the file exists?
    >
    > > $ perldoc -f sysopen
    >
    > > You'd need the O_CREAT and O_EXCL flags, something like:
    >
    > > sysopen(FH, $path, O_WRONLY|O_CREAT|O_EXCL)
    > > or die "sysopen: $path: $!";
    >
    > Note that this depends entirely on the cooperation of the OS and the
    > filesystem. This is almost always guaranteed to work on a local
    > filesystem of a UNIX machine. It is not guaranteed to work over NFS.
    Yep.

    The relevant FAQ (which I should have cited as well) makes this clear:

    % perldoc -q "why can't i just open"

    By the way: sorry for posting this old ("postponed" in tin) article;
    managed to squash just the right combination of keys with the heel of
    my hand and sent it out by mistake.

    --
    Steve
    Steve Grazzini Guest

  4. #4

    Default File Opening

    I am using studio 5 running on IIS, on my local machine. I have no problem
    opening files using the RDS://Local way in to my files, but when I try to
    access any files in folders via the windows file sytem I can only open files
    within the WWWROOT directory, and any files in directorys such as wwwroot/diary
    simply wont open.

    When I open a project pointing at the same directory I get File not found,
    even though the path displayed is correct ie c:\inetpub\wwwroot\diary\index.cfm.

    What is causing this please.


    Holmespw Guest

  5. #5

    Default Re: File Opening

    PS
    The files have been put on my local machine using a 3rd part FTP tool (FTP
    PRO).
    I have found that once I have changed a file via the rds local way, then the
    file then has a date attached to it in the studio browser window, and the file
    is then accessable through the studio explorer window or the project window.

    Holmespw Guest

Similar Threads

  1. Big 'X' when opening EPS file
    By tatedder in forum Macromedia Freehand
    Replies: 6
    Last Post: June 3rd, 05:34 PM
  2. Supspend opening the file after create pdf file from Adobe PDF
    By Ray_Li@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 2
    Last Post: May 20th, 02:55 PM
  3. Opening a .hlp file
    By SchneiderPapier webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 0
    Last Post: November 13th, 02:56 PM
  4. Bitmaps are displaced when opening FH9 file-I need a test file
    By Delores in forum Macromedia Freehand
    Replies: 2
    Last Post: July 25th, 08:22 PM
  5. Help -- Opening file
    By paulp2 in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 2
    Last Post: July 6th, 04:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139