in reply to Re: Config Module for C and Perl
in thread Config Module for C and Perl
#include <stdio.h> #include <stdlib.h> #include <EXTERN.h> #include <perl.h> static PerlInterpreter *my_perl; int main(void) { char *var; char *embedding[] = {"", "-e", "0"}; my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, NULL, 3, embedding, NULL); perl_run(my_perl); eval_pv("use MyConfig", TRUE); var = SvPV_nolen(get_sv("MyConfig::var", TRUE)); printf(">%s<\n", var); return(EXIT_SUCCESS); }
|
|---|