Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > A file open and close that doesnt modify a timestamp

Reply
Thread Tools

A file open and close that doesnt modify a timestamp

 
 
gumby
Guest
Posts: n/a
 
      10-27-2004
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).
 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      10-28-2004

Quoth Jim Gibson <(E-Mail Removed)>:
> In article <(E-Mail Removed) >, gumby
> <(E-Mail Removed)> 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)
* http://www.velocityreviews.com/forums/(E-Mail Removed) *
 
Reply With Quote
 
 
 
 
gumby
Guest
Posts: n/a
 
      10-28-2004
Jim Gibson <(E-Mail Removed)> wrote in message news:<271020041700435107%(E-Mail Removed) >...
> In article <(E-Mail Removed) >, gumby
> <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
How to close a TCP socket? (TCPSocket#close doesn't close it) IƱaki Baz Castillo Ruby 7 01-12-2010 01:32 PM
sort list doesnt work, key=str still doesnt work notnorwegian@yahoo.se Python 3 05-27-2008 04:32 AM
is better to open, write, close file than open, write, append, close? Iulian Ilea Javascript 1 12-21-2006 04:32 PM
PC doesnt boot first time and doesnt shutdown dann Computer Support 6 08-21-2006 07:31 AM



Advertisments