Vance M. Allen wrote:
> I'm trying to find out how to determine the date and/or time that a file was 
> created in a simple procedure.  I have heard about a few different libraries 
> but the examples I have found haven't been very useful.
> 
> The basic purpose I want to do is a simple footer provided by a package 
> module through CGI to inform users of the latest update to the code based on 
> the URL.  Something simple saying "Version x.xx, Last Modified MM/DD/YYYY." 
> which would automatically get the file modified timestamp.
> 
> I'd prefer to have, if possible, a simple scalar variable to store the 
> date...for example:
> 
> $modtime = filemoddate_func(filename.cgi);
> 
> If anyone can help me with the libraries I need to use for this (if any 
> special), and a code snippet if possible, I'd really appreciate it.
> 
> Thanks!
> 
> Vance
> 
> 
> 

Generally this type of information is provided by C<stat>, see,

perldoc -f stat

For the details.

To get the modification time for example you could use something like,

my $mod_time = (stat 'filename.cgi')[9];

File creation time is rarely if ever available. Obviously you could wrap
the above in a sub, but I suspect there isn't a lot of reason to since
it is so short anyways.

HTH,

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to