File-Raw-JSON

 view release on metacpan or  search on metacpan

JSON.xs  view on Meta::CPAN

# function CV is aliased into the caller's package via newXS, sharing
# the underlying XSUB pointer with the source CV.
#
# Recognised: file_json_decode, file_json_encode, :codec (= both),
# :all (= same).  Unknown names warn but don't die, matching File::Raw.
void
import(...)
PREINIT:
    const char *pkg;
    I32 i;
PPCODE:
    pkg = CopSTASHPV(PL_curcop);
    if (items <= 1) XSRETURN_EMPTY;

    for (i = 1; i < items; i++) {
        STRLEN len;
        const char *arg = SvPV(ST(i), len);

        if ((len == 6 && strEQ(arg, ":codec")) ||
            (len == 4 && strEQ(arg, ":all")))
        {

JSON.xs  view on Meta::CPAN

# Calling convention: overload invokes our handlers with three args
# (self, other, swap). We only need self; ignore the rest. Returning
# the static PL_sv_yes / PL_sv_no avoids per-call SV allocation.

MODULE = File::Raw::JSON    PACKAGE = File::Raw::JSON::Boolean

PROTOTYPES: DISABLE

void
TRUE(...)
    PPCODE:
        PERL_UNUSED_VAR(items);
        if (!g_frj_true_sv) init_boolean_singletons(aTHX);
        SvREFCNT_inc_simple_void(g_frj_true_sv);
        XPUSHs(sv_2mortal(g_frj_true_sv));
        XSRETURN(1);

void
FALSE(...)
    PPCODE:
        PERL_UNUSED_VAR(items);
        if (!g_frj_false_sv) init_boolean_singletons(aTHX);
        SvREFCNT_inc_simple_void(g_frj_false_sv);
        XPUSHs(sv_2mortal(g_frj_false_sv));
        XSRETURN(1);

SV *
overload_bool(self, other, swap)
    SV *self
    SV *other



( run in 0.401 second using v1.01-cache-2.11-cpan-5511b514fd6 )