Hello All, I'm writing an app which uses perl as it's scripting langauge and I've just gotten around to using magic to link the C variables for my app's preferences to variables in the embedded perl so scripts can change the preferences. Magic for SVs turned out to be simpler than I expected, but magic for HVs ans AVs looks like it's going to be much more complicated.
For arrays and hashes, am I going to have to manually set magic for each individual SV element? And for arrays of arrays or arrays of hashes, too? I don't quite understand what the hv_magic() function is supposed to do. In perlguts "Assigning Magic" it just says "This simply calls sv_magic and coerces the gv argument into an SV." But hv_magic() doesn't have the last 2 parameters that sv_magic() does. Can I do something like this: av = get_av("my_array", TRUE); sv_magic((SV *)av, NULL, 'U', (char *)data, sizeof(data)); mg = mg_find((SV *)av, 'U'); mg->mg_virtual = (MGVTBL *)calloc(1, sizeof(MGVTBL)); mg->mg_virtual->svt_get = GetLinkedVar; mg->mg_virtual->svt_get = SetLinkedVar; and if yes, then in GetLinkedVar() and SetLinkedVar() how do I tell what element of the array I am accessing? It would be nice if there was a function av_magic() that had all the parameters of sv_magic(), but when mg_virtual->svt_get was called for this AV, in addition to the SV * and MAGIC * paramters there would be a third one indicating the actual array element that SV * is. Doing that coudl remove the necessity for have to set magic on each inidvidual SV in an array. I'd really appreciate it if anybody could point me to any examples of using magic to link perl arrays/hashes to C/C++ variables, or fuller documentation/examples than exist in perlguts. Thanks in advance. -- Cory C. Albrecht Access denied - nah nah na nah nah! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]