Professional Web Applications Themes

Help needed on File manipulation - PERL Beginners

Hi, I am writing a Perl program that reads files created by another independent process. I have to take care that the perl program does not read the files that are in the process of getting created. I am programming in Windows NT environment. It is also not possible for the perl program to get triggered by the other process that creates the files. Is there any method by which it can detected whether the file is already in use by the another process -- any modules or commands (already tried open command). The file open function in perl returns ...

  1. #1

    Default Help needed on File manipulation

    Hi,
    I am writing a Perl program that reads files created by another independent process.
    I have to take care that the perl program does not read the files that are in the process of
    getting created.
    I am programming in Windows NT environment.
    It is also not possible for the perl program to get triggered by the other process that creates
    the files.

    Is there any method by which it can detected whether the file is already in use by the another
    process -- any modules or commands (already tried open command).

    The file open function in perl returns an error if the file is already in use. But is there some
    better way to do this?
    Thanks

    __________________________________
    Do you Yahoo!?
    The New Yahoo! Shopping - with improved product search
    [url]http://shopping.[/url]
    Chinku Simon Guest

  2. #2

    Default Re: Help needed on File manipulation

    I'm a perl noob, so I'm not sure if this is the best way to do it, but
    just a thought:

    When a program is accessing the file create a file like:
    filename.lock. Delete it when you're done. Then check to see if
    filename.lock exists before trying to access the program -- if not
    sleep.

    Of course, I assume there has to be a better way to do this. And
    accessing file i/o will slow things down compared with something that
    could be done in RAM. (Which may or may not be a problem depending on
    what kind of program you are creating).

    -Dan

    Dan Anderson Guest

Similar Threads

  1. Ini File Manipulation
    By Alexander Popkov in forum ASP Components
    Replies: 2
    Last Post: May 3rd, 01:59 PM
  2. Help on file manipulation
    By Zsdc in forum PERL Beginners
    Replies: 0
    Last Post: August 28th, 07:50 PM
  3. File Manipulation
    By AshDav webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 2
    Last Post: July 16th, 12:16 PM
  4. [PHP] Text file manipulation question.
    By Mike Ford in forum PHP Development
    Replies: 0
    Last Post: July 15th, 09:24 AM
  5. Text file manipulation question.
    By Lloyd Bayley in forum PHP Development
    Replies: 2
    Last Post: July 15th, 12:20 AM

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