T
Torsten Mohr
Hi,
i'd like to write a C program that allocates a
PerlInterpreter* and executes a script that is
contained as a "char*" in the C program. I don't
want to load the script from a file.
The parameters that the C program gets should be
available in the perl script.
I looked through "perldoc perlembed" and "perlapi",
but i didn't find anything that really matches this.
"perl_parse" seems to be necessary to get @ARGV, but
if i don't pass {"", "-e", "0"} to it, it tries to
get input from stdin.
If i leave perl_parse away, the C program crashes.
Also, adding a line like "PERL_SYS_INIT3(&argc, &argv, &env);"
neither at the beginning nor before eval_pv(script_pointer, TRUE)
didn't help.
Has anybody got an example C program, that:
- executes a script that resides in memory
- makes @ARGV available to that script
- doesn't try to get input from stdin
I didn't find anything googling for it or in the source
tarball.
thanks for any hints,
Torsten.
i'd like to write a C program that allocates a
PerlInterpreter* and executes a script that is
contained as a "char*" in the C program. I don't
want to load the script from a file.
The parameters that the C program gets should be
available in the perl script.
I looked through "perldoc perlembed" and "perlapi",
but i didn't find anything that really matches this.
"perl_parse" seems to be necessary to get @ARGV, but
if i don't pass {"", "-e", "0"} to it, it tries to
get input from stdin.
If i leave perl_parse away, the C program crashes.
Also, adding a line like "PERL_SYS_INIT3(&argc, &argv, &env);"
neither at the beginning nor before eval_pv(script_pointer, TRUE)
didn't help.
Has anybody got an example C program, that:
- executes a script that resides in memory
- makes @ARGV available to that script
- doesn't try to get input from stdin
I didn't find anything googling for it or in the source
tarball.
thanks for any hints,
Torsten.