Stas Bekman wrote:
Stas Bekman wrote:
Geoff,
APR::Finfo::stat() doesn't do what C API does. The C API populates finfo for the file passed in the argument. The current perl API doesn't do that. It populates only $r->finfo, passed as an argument, which may not exist at all.
I really don't understand what you mean here. APR::Finfo::stat() is autogenerated, so it behaves _exactly_ as the C API does.
+ my $finfo = APR::Finfo::stat($file, APR::FINFO_NORM, $r->pool);
the C apr_stat() function takes an apr_finfo_t structure as the first argument. where are you getting your apr_finfo_t from? wherever it is that you are doing it, as I see it you are creating one of two problems.
- if you're using r->finfo() then you're presupposing a request_rec in an APR routine, as well as limiting any other use of apr_stat() that doesn't involve r->finfo.
- if you are creating your own apr_finfo_t, then how does one populate r->finfo? you absolutely need a way to do that otherwise you can never update the data that apache uses to make certain decisions, which is the entire point of populating r->finfo via $r->finfo.
- my $status = $r->finfo->stat($file, APR::FINFO_NORM, $r->pool);
so, this looks just fine to me. I suppose if you want to stat another file you need to figure out a way to generate an apr_finfo_t structure on your own, as there currently isn't any method I can see that returns an apr_finfo_t other than $r->finfo(). but that doesn't mean we shouldn't add one :)
Well, populating $r->finfo is not a job of APR::Finfo which must be independent from httpd. The adjusted method does:
static MP_INLINE apr_finfo_t *mpxs_APR__Finfo_stat(pTHX_ const char *fname, apr_int32_t wanted, apr_pool_t *p) { apr_finfo_t *finfo = (apr_finfo_t *)apr_pcalloc(p, sizeof(apr_finfo_t));
MP_RUN_CROAK(apr_stat(finfo, fname, wanted, p), "APR::IpSubnet::new");
return finfo; }
Yes, it returns that structure.
Next do:
$r->finfo($finfo);
and you are all set. of course after adjusting this:
static MP_INLINE apr_finfo_t *mpxs_Apache__RequestRec_finfo(request_rec *r) { return &r->finfo; }
to be settable.
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]