hi everybody.
i have a slight problem here.
my task involve calling c from perl which inturn has perl embedded in it.
this is my c code which i call 1.c
#include <EXTERN.h> #include <perl.h> static PerlInterpreter *my_perl; int main(int argc, char **argv, char **env) { char *myargv[] ={"","Random.pl"}; PERL_SYS_INIT3(&argc,&argv,&env); my_perl=perl_alloc(); perl_construct(my_perl); PL_exit_flags |= PERL_EXIT_DESTRUCT_END; perl_parse(my_perl,NULL,argc,myargv,(char**)NULL); perl_run(my_perl); perl_destruct(my_perl); perl_free(my_perl); PERL_SYS_TERM(); }
this is my random.pl
package cryzone; print "Hello"; print " i am in random"; print $cryzone::a; 1;
this is my file test.pl from which i call 1.exe
use cryzone; $cryzone::a=1; print $cryzone::a; system("1.exe"); $cryzone::a=2; print $cryzone::a;
and this is my package cryzone
package cryzone; $a=0; 1;
on running i am never able to access $cryzone::a inside random.pl even though ihave declared it as belonging to cryzone.
how can this be solved.
the output is
1Hello i am in random2whereas the desired output is
1Hello i am in random12please help me.
Edited by planetscape - added code tags around output
In reply to embedding perl by rocketboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |