It seems that for $r->finfo we can't provide a familar get/set idiom of returning the previous value when the new value is set:

  $r->finfo($finfo);

Normally we try to return the previous value, but in this case in C land: r->finfo is the struct itself, not a pointer to it. So $r->finfo($finfo) completely overwrites the previous data, w/o touching &r->finfo pointer. The C wrapper does:

apr_finfo_t *mpxs_Apache__RequestRec_finfo(pTHX_ request_rec *r,
                                           apr_finfo_t *finfo)
{
    if (finfo) {
        r->finfo = *finfo;
    }

    return &r->finfo;
}

So if you have done:

  my $old_finfo = $r->finfo;

and then:

  $r->finfo($new_finfo);

$old_finfo is now the same as $new_finfo. As both point to the same memory block. The address of r->info doesn't change.

Due to this fact, I see no point in trying to return the old value in the set mode.

We could do a full copy when called in the set-mode in non-VOID mode, but then these two will be not equivalent:

  my $old_finfo = $r->finfo;
  $r->finfo($new_finfo);

and:

  my $old_finfo = $r->finfo($new_finfo);

So it'll be only confusing and error-prone.

Therefore the current doc entry goes like this:

=head2 C<finfo>

Get and set the I<finfo> request record member:

  $finfo = $r->finfo();
  $finfo = $r->finfo($finfo);

=over 4

=item obj: C<$r>
( C<L<Apache::RequestRec object|docs::2.0::api::Apache::RequestRec>> )

=item opt arg1: C<$finfo>
( C<L<APR::Finfo object|docs::2.0::api::APR::Finfo>> )

=item ret: C<$finfo>
( C<L<APR::Finfo object|docs::2.0::api::APR::Finfo>> )

Always returns the current object.

Due to the internal Apache implementation it's not possible to have
two different objects originating from C<$r-E<gt>finfo> at the same
time. Whenever C<$r-E<gt>finfo> is updated all objects will be updated
too to the latest value.

=item since: 1.99_14

=back


-- __________________________________________________________________ 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]



Reply via email to