I have some code like the following:
char *code = "some perl code";
eval_pv(code, 0);
if (SvTRUE(ERRSV)) {
// Get the error...
msg = SvPV_nolen(ERRSV);
}
This code works wit 5.8, but now that I have upgraded to 5.10
(ActivePerl) it crashes. The problem seems to be that PL_errgv
is NULL. How can I fix my code to not crash?
George
> This code works wit 5.8, but now that I have upgraded to 5.10
> (ActivePerl) it crashes. The problem seems to be that PL_errgv is NULL.
> How can I fix my code to not crash?
Are you absolutely sure of that? PL_errgv being NULL is highly unlikely.
Can you printf("PL_errgv = %p\n", PL_errgv) first? Are you sure you're
not linking wrongly? (e.g. including headers from one version but linking
against the library of another, that would cause these kinds of
problems).
Regards,
Leon
I have installed ActivePerl 5.10.0 (only) in my system.
And yes, PL_errgv is NULL. I have printed it, as I get a crash when it
was used :-(
Loading dll...
perl::interp new..
PL_errgv: 00000000
executing command!
done!
Regards,
George
In general, what is the suggested way to eval a script from C, and get
the error message if there is an error during execution?
George
> O/H Leon Timmermans έγραψε:
>
> I have installed ActivePerl 5.10.0 (only) in my system.
>
> And yes, PL_errgv is NULL. I have printed it, as I get a crash when it
> was used :-(
>
> Loading dll...
> perl::interp new..
> PL_errgv: 00000000
> executing command!
> done!
>
> Regards,
>
> George
Hi George,
Can you show me the code you use to initialize the interpreter? In
particular: does it include a call to perl_parse()? Also, you said "I
have some code like the following": Does this *exact* code also give
exactly this error?
Regards,
Leon
Dear Leon,
You can find the complete code at:
http://ellogon.svn.sourceforge.net/viewvc/ellogon/trunk/lib/tclperl-3.2/tclperl.c?revision=1&view=markup
Yes, I am using perl_parse():
PERL_SET_CONTEXT(my_perl);
perl_construct(my_perl);
perl_parse(my_perl, xs_init, 3, embedded, 0);
perl_run(my_perl);
eval_pv(code, 0);
SvTRUE(ERRSV); <- crash :-(
Regards,
George
> O/H Leon Timmermans έγραψε:
>
>
> Dear Leon,
>
> You can find the complete code at:
> http://ellogon.svn.sourceforge.net/viewvc/ellogon/trunk/lib/tclperl-3.2/
tclperl.c?revision=1&view=markup
>
> Yes, I am using perl_parse():
>
> PERL_SET_CONTEXT(my_perl);
> perl_construct(my_perl);
> perl_parse(my_perl, xs_init, 3, embedded, 0); perl_run(my_perl);
> eval_pv(code, 0);
> SvTRUE(ERRSV); <- crash :-(
>
> Regards,
>
> George
Hi,
Can you check the value of PL_errgv directly after perl_parse() and
perl_run() too?
Leon
Dear Leon,
It is always NULL:
perl::interp new...
After perl_construct: PL_errgv: 00000000
After perl_parse: PL_errgv: 00000000
After perl_run: PL_errgv: 00000000
After eval_pv: PL_errgv: 00000000
How can this be possible? Am I doing anything wrong during compilation?
(I.e. have I missed any flags? I have used the output of "perl
-MExtUtils::Embed -e ccopts" to get the flags...)
Regards,
George
Hi,
The value should be set during perl_parse(). Can you check the return
value of it? I think it should be zero (but it isn't documented properly,
so I'm not entirely sure).
Regards,
Leon
It is NULL (0).
George