in reply to Did that file change?
(i also assumed the ';' in the return string was a typo)sub FileMeta { my $fh = shift; my ($dev, $inode, $size, $mtime) = ($fh ? stat($fh) : stat(_))[0,1,7 +,9]; return join ":", $size, $dev, $inode, $mtime; }
Another approach (though you noted avoiding modules) would be to MD5 the string and return that so that .. or to include in the unique string the MD5 of the contents (of course that's more overhead as well).sub FileMeta { my $fh = shift; # glue together the size, dev, inode, and mtime return join ":", ($fh ? stat($fh) : stat(_))[7,0,1,9]; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Did that file change?
by whio (Beadle) on Jun 01, 2006 at 09:03 UTC | |
by davidrw (Prior) on Jun 01, 2006 at 12:34 UTC | |
by ruzam (Curate) on Jun 02, 2006 at 18:51 UTC | |
|
Re^2: Did that file change?
by ruzam (Curate) on Jun 01, 2006 at 03:10 UTC |