shigetsu has asked for the wisdom of the Perl Monks concerning the following question:
I've embedded Perl in C. Everything goes well, except when I pass a string to eval_sv() that contains literal metacharacters, croak is being called.
So I tried to call quotemeta via the following C subroutine, but quotemeta never gets found. My next idea was to use the implementation of pp_quotemeta in B::Deparse, but that didn't work either.
I'd be grateful for some insight offered.
static void call_quotemeta(SV *string) { int count; SV *output; dSP; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(string)); PUTBACK; count = call_pv("quotemeta", G_SCALAR); SPAGAIN; if (count != 1) croak("Big trouble\n"); output = POPs; PUTBACK; FREETMPS; LEAVE; return output; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: embedding Perl in C / calling Perl core function from C
by Joost (Canon) on Dec 10, 2006 at 23:58 UTC |