diotalevi has asked for the wisdom of the Perl Monks concerning the following question:
In trying to get somewhere with [id://???] I wrote a quick XS library to gain access to some perl internal variables. My initial thought was to create an accessor for each variable I was interested in and just write a normal perl sub to format and print them. No such luck. My XSUB accessors returned globs instead of integers. I think this is really basic stuff but it still eluded me.
All I did was a basic `h2xs -n Devel::DebugScope`, edit the created .xs file to add my functions and run it. Eventually I just punted and did the dump right from the C code. I've included that bit as well.
MODULE = Devel::DebugScope PACKAGE = Devel::DebugScope + PREFIX = ds_ I32 ds_scopestack_ix() CODE: RETVAL = PL_scopestack_ix; int ds_savestack_ix() CODE: RETVAL = PL_savestack_ix; void dump_scope() CODE: printf("scopestack_ix: %d\n", PL_scopestack_ix); printf("savestack_ix: %d\n", PL_savestack_ix); __END__ print savestack_ix() returns "*main::savestack_ix" This is the part that eludes me. It should just be an integer and wher +e the glob comes from... *shrug*
Fun Fun Fun in the Fluffy Chair
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XS code returns GLOB instead of IV
by MarkM (Curate) on Dec 23, 2002 at 21:13 UTC | |
by diotalevi (Canon) on Dec 23, 2002 at 21:20 UTC | |
|
Re: XS code returns GLOB instead of IV
by MarkM (Curate) on Dec 23, 2002 at 20:47 UTC | |
by diotalevi (Canon) on Dec 23, 2002 at 20:52 UTC |