perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: [rfc] APR::Table & polymorphic values
Date Wed, 04 Jun 2003 02:16:43 GMT
Stas Bekman <stas@stason.org> writes:


[...]

> Still, once user tries to modify the data, what happens to meta-data?
> When COW is performed, does it copy the whole thing or just whatever
> was pointed by SvCUR?

Doesn't matter.  The point is that if there's an Apache::Request::Table
that subclasses APR::Table, it doesn't have to *reimplement everything*
in APR::Table.  It can just fixup the return values before they are
returned, like this:

  package Apache::Request::Table;
  use base 'APR::Table';

  sub get {
     if (wantarray) {
        return map {fixup_sv($_)} &APR::Table::get;   
    }
    else {
        return fixup_sv(scalar &APR::Table::get);
    }
  }

The only XSUB we'd need to maintain in the subclass is fixup_sv().
But if APR::Table uses newSVpvn, Apache::Request::Table would need
to *completely reimplent all* the APR::Table XSUBS.
-- 
Joe Schaefer


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message