Class-Accessor-Fast-GXS

 view release on metacpan or  search on metacpan

lib/Class/Accessor/Fast/GXS.pm  view on Meta::CPAN

    print $fh "MODULE = ". ($MODULE||$class) ." PACKAGE = $class\n\n";

    my $length = length $field;
    print $fh <<END;
void
__xs_$name(self)
    SV* self;
  PROTOTYPE: DISABLE
  INIT:
    SV** res;
  PPCODE:
    res = hv_fetch((HV *)SvRV(self), "$field", $length, 0);
    if (res == NULL)
        XSRETURN_UNDEF;

    XPUSHs(*res);

END

    return undef;
}

lib/Class/Accessor/Fast/GXS.pm  view on Meta::CPAN

    my $length = length $field;
    print $fh <<END;
void
__xs_$name(self, ...)
    SV* self;
  PROTOTYPE: DISABLE
  INIT:
    SV **res;
    SV *newvalue;
    IV i;
  PPCODE:
    if ( items == 2 ) {
        newvalue = SvREFCNT_inc(ST(1));
    } else if ( items > 2 ) {
        AV* tmp = newAV();
        av_extend(tmp, items-1);
        for(i = 1; i < items; i++) {
            if (!av_store(tmp, i - 1, SvREFCNT_inc(ST(i)))) {
                SvREFCNT_dec(ST(i));
                croak("Cannot store value in array");
            }

lib/Class/Accessor/Fast/GXS.pm  view on Meta::CPAN

    my $length = length $field;
    print $fh <<END;
void
__xs_$name(self, ...)
    SV* self;
  PROTOTYPE: DISABLE
  INIT:
    SV **res;
    SV *newvalue;
    IV i;
  PPCODE:
    if ( items == 1 ) {
        res = hv_fetch((HV *)SvRV(self), "$field", $length, 0);
        if (res == NULL)
            XSRETURN_UNDEF;

        XPUSHs(*res);
        XSRETURN(1);
    }
    else if ( items == 2 ) {
        newvalue = SvREFCNT_inc(ST(1));



( run in 0.500 second using v1.01-cache-2.11-cpan-71847e10f99 )