Update of /cvsroot/sandweb/sandweb/lib/SandWeb
In directory usw-pr-cvs1:/tmp/cvs-serv6012/lib/SandWeb
Modified Files:
Browse.pm File.pm
Log Message:
Browse now instantiates a file object so it can pull the size ( in bytes )
and age ( the mtime, in "UNIX time" which is seconds since the epoch )
File needs some reworking to eliminate redundancy, I will do the
byte->kilobyte and "UNIX time"->"Standard Time" calculations when
I do this reworking.
Index: Browse.pm
===================================================================
RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/Browse.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -U2 -r1.17 -r1.18
--- Browse.pm 2001/11/15 20:11:42 1.17
+++ Browse.pm 2001/11/22 01:40:25 1.18
@@ -7,4 +7,5 @@
use lib '../lib';
use SandWeb::UI;
+use SandWeb::File;
use HTML::Template;
@@ -104,4 +105,10 @@
$row_data{ENTRY} = shift @return;
$filename = $row_data{ENTRY};
+ my $file = SandWeb::File->new(
+ location => "$sandbox/$path",
+ filename => "$filename",
+ );
+ $row_data{FILESIZE} = $file->get_size();
+ $row_data{FILEAGE} = $file->get_age();
if (-d "$sandbox/$path/$filename") {
if ($repo_type eq "CVS") {
Index: File.pm
===================================================================
RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/File.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -U2 -r1.8 -r1.9
--- File.pm 2001/11/15 19:46:20 1.8
+++ File.pm 2001/11/22 01:40:25 1.9
@@ -80,3 +80,29 @@
}
+sub get_size {
+ my $self = shift;
+
+ my $location = $self->{'location'};
+ my $filename = $self->{'filename'};
+
+ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+ $atime,$mtime,$ctime,$blksize,$blocks)
+ = stat("$location/$filename");
+
+ return $size;
+}
+
+sub get_age {
+ my $self = shift;
+
+ my $location = $self->{'location'};
+ my $filename = $self->{'filename'};
+
+ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+ $atime,$mtime,$ctime,$blksize,$blocks)
+ = stat("$location/$filename");
+
+ return $mtime;
+}
+
1;
|