In which circumstances the access time changes ?

S

sanjeeb

Hi
Can any one please clarify my doubts.

In which circumstances the access time changes
1. If script open a file in read/write/append mode.
2. If script uses system command to execut a file . (Doubt is here)
3. Suppose a module is imported. Is the access time changes when it is
imported(*.pm files)(Doubt is here).


Is there any method to know the files in a specified directory
which are executed/read/written during the execution of a tool(.exe not

..pl).


With Regards
Sanjeeb
 
B

Bart Van der Donck

sanjeeb said:
In which circumstances the access time changes
1. If script open a file in read/write/append mode.
2. If script uses system command to execut a file . (Doubt is here)
3. Suppose a module is imported. Is the access time changes when it is
imported(*.pm files)(Doubt is here).
Is there any method to know the files in a specified directory
which are executed/read/written during the execution of a tool(.exe not
.pl).

I think you're looking for

perldoc -f stat

Code example:

my $file='/path/to/somefile.ext';
my @stat=stat $file;
print "last modified: ", scalar(localtime($stat[9])),"\n";
print "last access: ", scalar(localtime($stat[8])),"\n";
 
S

sanjeeb

ya thats correct Bart Van der Donck .
I have read that help file and and so also written a program but its
not showing the file which are accessed(read/write/executed) during the
execution of a tool. moreover its inconsistent. Sometime the same file
which was read/written/executed was seen on the console some times not.

so again i am putting the same question

1. If script open a file in read/write/append mode.
2. If script uses system command to execut a file . (Doubt is here)
3. Suppose a module is imported. Is the access time changes when it is
imported(*.pm files)(Doubt is here).


OS-WinXp....Active perl

I have put the code in the previous mail and some more information
about that. Please refer the mail with subject line "Access time
problem".


With ragrads
sanjeeb
 
A

Anno Siegel

sanjeeb said:
Hi
Can any one please clarify my doubts.

In which circumstances the access time changes
1. If script open a file in read/write/append mode.
2. If script uses system command to execut a file . (Doubt is here)
3. Suppose a module is imported. Is the access time changes when it is
imported(*.pm files)(Doubt is here).

That depends on the OS you are using or rather on the file system your
OS is using. Perl only reports what it gets from there.

Anno
 
B

Bart Van der Donck

Anno said:
That depends on the OS you are using or rather on the file system your
OS is using. Perl only reports what it gets from there.

Yes - for that reason, I think it's best to code it out in the script
itself, for maximum portability and reliability.

Like

print LOGFILE scalar(localtime)
.': command "dir" was executed' if qx{dir};

etc.

Then read out LOGFILE when you need the values. CPAN might have modules
for that kind of jobs, too.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top