stas 2004/05/24 12:55:14
Modified: t/response/TestAPR finfo.pm
xs/maps apr_functions.map
Added: xs/APR/Finfo APR__Finfo.h
Log:
change stat() to return finfo
Revision Changes Path
1.4 +26 -0 modperl-2.0/xs/APR/Finfo/APR__Finfo.h
1.11 +19 -22 modperl-2.0/t/response/TestAPR/finfo.pm
Index: finfo.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/finfo.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -u -r1.10 -r1.11
--- finfo.pm 3 May 2004 12:54:08 -0000 1.10
+++ finfo.pm 24 May 2004 19:55:14 -0000 1.11
@@ -14,13 +14,13 @@
use Apache::RequestRec ();
use APR::Finfo ();
-use APR::Const -compile => qw(SUCCESS FINFO_NORM REG
- WREAD WWRITE WEXECUTE);
use File::Spec::Functions qw(catfile);
use Fcntl qw(:mode);
use Apache::Const -compile => 'OK';
+use APR::Const -compile => qw(SUCCESS FINFO_NORM REG
+ WREAD WWRITE WEXECUTE);
sub handler {
my $r = shift;
@@ -44,16 +44,13 @@
}
my $file = $r->server_root_relative(catfile qw(htdocs index.html));
+ # populate the finfo struct first
+ my $finfo = APR::Finfo::stat($file, APR::FINFO_NORM, $r->pool);
- # stat tests
- {
- # populate the finfo struct first
- my $status = $r->finfo->stat($file, APR::FINFO_NORM, $r->pool);
-
- ok t_cmp(APR::SUCCESS,
- $status,
- "stat $file");
+ ok $finfo->isa('APR::Finfo');
+ # stat tests (same as perl's stat)
+ {
# now, get information from perl's stat()
our ($device, $inode, $protection, $nlink, $user, $group,
undef, $size, $atime, $mtime, $ctime) = stat $file;
@@ -81,8 +78,8 @@
}
else {
ok t_cmp(${$method},
- $r->finfo->$method(),
- "\$r->finfo->$method()");
+ $finfo->$method(),
+ "\$finfo->$method()");
}
}
}
@@ -90,20 +87,20 @@
# match world bits
ok t_cmp($protection & S_IROTH,
- $r->finfo->protection & APR::WREAD,
- '$r->finfo->protection() & APR::WREAD');
+ $finfo->protection & APR::WREAD,
+ '$finfo->protection() & APR::WREAD');
ok t_cmp($protection & S_IWOTH,
- $r->finfo->protection & APR::WWRITE,
- '$r->finfo->protection() & APR::WWRITE');
+ $finfo->protection & APR::WWRITE,
+ '$finfo->protection() & APR::WWRITE');
if (WIN32) {
skip "different file semantics", 0;
}
else {
ok t_cmp($protection & S_IXOTH,
- $r->finfo->protection & APR::WEXECUTE,
- '$r->finfo->protection() & APR::WEXECUTE');
+ $finfo->protection & APR::WEXECUTE,
+ '$finfo->protection() & APR::WEXECUTE');
}
}
@@ -115,13 +112,13 @@
}
else {
ok t_cmp($file,
- $r->finfo->fname,
- '$r->finfo->fname()');
+ $finfo->fname,
+ '$finfo->fname()');
}
ok t_cmp(APR::REG,
- $r->finfo->filetype,
- '$r->finfo->filetype()');
+ $finfo->filetype,
+ '$finfo->filetype()');
}
Apache::OK;
1.79 +2 -1 modperl-2.0/xs/maps/apr_functions.map
Index: apr_functions.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/apr_functions.map,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -u -r1.78 -r1.79
--- apr_functions.map 22 May 2004 21:47:32 -0000 1.78
+++ apr_functions.map 24 May 2004 19:55:14 -0000 1.79
@@ -309,7 +309,8 @@
MODULE=APR::Finfo
-apr_lstat
- apr_stat
+-apr_stat
+ mpxs_APR__Finfo_stat
!MODULE=APR::String
apr_collapse_spaces