I have embedded a Perl interpreter in a C program and loaded the following Perl code into it.
package xmlutil; use XML::Simple; #use strict; # I need symbolic dereferencing. my $xmlFile = "./galaxy.xml"; my $config = XMLin($xmlFile); sub get_ival { $parm_str = $_[0]; # reference the parameter directly. Prints Jane's number print "ref1 = ", $config->{jane}->{tel_no}, "\n"; # attempt to use symbolic dereference. Yields nothing! print "ref2 = ", $$parm_str, "\n"; # construct the same symbolic reference locally # just to make sure. Still yields nothing! $parm_str = "\$" . "config->{jane}->{tel_no}, "\n"; print "ref3 = ", $$parm_str, "\n"; }
My intension is to use the XML::Simple interface from the C code to extract data from the XML. I am currently using the following C code to call the Perl subroutine.
void get_ival( int *int_p, char *parm_str_p ) { char cmd_str[255]; STRLEN na; SV *val; dSP; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs( sv_2mortal( newSVpv( parm_str_p, 0 ) ) ); PUTBACK; call_pv( "xmlutil::get_ival", G_DISCARD ); FREETMPS; LEAVE; }
Can anyone shine a light on how I work arround this problem?
Thanks for your help Wise Ones! :)
Phil
Please note that the square brace characters went funny when I submitted this text. They are there in a couple of places and have turned into links(?) :)
Edit ar0n -- replaced pre with code tags
In reply to Problem with symbolic deferencing into XML::Simple's internal representation of an XML file. by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |