-
- cat of perlportable.c
- -----
- #include <EXTERN.h>
- #include <perl.h>
-
- /* we're going to embed two interpreters */
-
- #define SAY_HELLO "-e", "$string = $^X; $string =~ s/.*\///; $newstring = $^X ; $newstring =~ s/$string//; print $newstring;"
- int main(int argc, char **argv, char **env)
- {
- PerlInterpreter *one_perl;
- char *one_args[] = { "one_perl", SAY_HELLO };
- PERL_SYS_INIT3(&argc,&argv,&env);
- one_perl = perl_alloc();
- PERL_SET_CONTEXT(one_perl);
- perl_construct(one_perl);
- perl_parse(one_perl, NULL, 3, one_args, (char **)NULL);
- perl_run(one_perl);
- perl_destruct(one_perl);
- perl_free(one_perl);
- PERL_SYS_TERM();
- }
- -----
- perlportable.c: In function ‘main’:
- perlportable.c:10:46: warning: unknown escape sequence: '\/'
- char *one_args[] = { "one_perl", SAY_HELLO };
- ^
- executing a.out
- syntax error at -e line 1, near "/;"
- Execution of -e aborted due to compilation errors.
-