A file open and close that doesnt modify a timestamp

Discussion in 'Perl Misc' started by gumby, Oct 27, 2004.

  1. gumby

    gumby Guest

    I need to be able to open a file, read a file, then close a file with
    out perl rewriting the TimeStamp on the file. I was able to do this
    in C++ but not perl, and currently we are rewriting our old C code to
    perl.

    Here is what i am using currently
    unless(open FILE, $fileName)
    {
    #here i pop an TK error window
    }

    while(<FILE>)
    {
    #Read and process the information so i can display it
    }

    close FILE;

    I have looked into, since i already detect the timeStamp on the file,
    keeping that timeStamp in memory then when i close the file using
    utime to rewrite the Timestamp. I havent run any tests to see how
    well that would work yet. Was just wondering if someone else has had
    the same issue(I didnt see anything in the perldoc).
     
    gumby, Oct 27, 2004
    #1
    1. Advertising

  2. gumby

    Ben Morrow Guest

    Quoth Jim Gibson <>:
    > In article <>, gumby
    > <> wrote:
    >
    > > I need to be able to open a file, read a file, then close a file with
    > > out perl rewriting the TimeStamp on the file. I was able to do this
    > > in C++ but not perl, and currently we are rewriting our old C code to
    > > perl.

    >
    > What operating system and version of Perl are you using? On my system
    > (Mac OS 10.3, perl 5.8.5), opening and reading a file changes none of
    > the file times atime, mtime, nor ctime.


    A read of more than zero bytes ought to update the atime. Many systems
    do not perform this update as a optimisation (under Linux, for example,
    it is a mount-time option on most filesystems).

    If the OP wants a last-mod-time he (?) wants to use the mtime. On
    non-Unix OSen the meanings of the various times are different, and they
    may be updated under different circumstances; the perlfoo (e.g.
    perlwin32) page for your OS should say what they mean.

    Ben

    --
    And if you wanna make sense / Whatcha looking at me for? (Fiona Apple)
    * *
     
    Ben Morrow, Oct 28, 2004
    #2
    1. Advertising

  3. gumby

    gumby Guest

    Jim Gibson <> wrote in message news:<271020041700435107%>...
    > In article <>, gumby
    > <> wrote:
    >
    > > I need to be able to open a file, read a file, then close a file with
    > > out perl rewriting the TimeStamp on the file. I was able to do this
    > > in C++ but not perl, and currently we are rewriting our old C code to
    > > perl.
    > >

    >
    >
    > What operating system and version of Perl are you using? On my system
    > (Mac OS 10.3, perl 5.8.5), opening and reading a file changes none of
    > the file times atime, mtime, nor ctime.


    We are currently using AIX. We have two file structures in place AFS,
    and DFS. On the AIX system I have verfied that an open will change
    the last modified time stamp on the file, where if i just ez the file
    it wont change the last modified time stamp unless you save and exit.
    I will look up some more info on the utime and how it works with AIX.
    Thanks for the help.
     
    gumby, Oct 28, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jae
    Replies:
    5
    Views:
    1,153
    Thomas Fritsch
    Sep 14, 2005
  2. Replies:
    3
    Views:
    456
    alex23
    May 27, 2008
  3. Dani
    Replies:
    3
    Views:
    501
  4. Iñaki Baz Castillo
    Replies:
    7
    Views:
    921
    Iñaki Baz Castillo
    Jan 12, 2010
  5. Iulian Ilea
    Replies:
    1
    Views:
    335
    pcx99
    Dec 21, 2006
Loading...

Share This Page