Router-XS

 view release on metacpan or  search on metacpan

XS.xs  view on Meta::CPAN

ROOT = NodeNew("");

void
add_route(path, coderef)
  SV *path
  SV *coderef
  PREINIT:
    char *pathstr;
    size_t pathlen, numcaptures = 0;

  PPCODE:
    SvGETMAGIC(path);

    /* check for undef, empty string */
    if (!SvOK(path) || !SvCUR(path) || !SvROK(coderef))
    {
      croak("requires path and coderef arguments");
    }

    pathstr = SvPV_nomg(path, pathlen);

XS.xs  view on Meta::CPAN

    PUSHs(sv_newmortal());

void
check_route(path)
  SV *path
  PREINIT:
    char *pathstr;
    SV *coderef;
    size_t numcaptures = 0, caplen, pathlen;

  PPCODE:
    SvGETMAGIC(path);

    /* check for undef, empty string */
    if (!SvOK(path) || !SvCUR(path))
    {
      croak("requires path");
    }

    pathstr = SvPV_nomg(path, pathlen);
    coderef = NodeTestPath(ROOT, pathstr, pathlen, &numcaptures);



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