Jim Cromie <[EMAIL PROTECTED]> writes: >folks, > >I just tried to modify Devel::Size to teach it to compute the size >of subroutines. Since B::Concise can walk an optree, >Im trying to call it (perl code) from Devel::Size::thing_size >(XS code). > >Ive followed the recipe in perldoc perlcall (1 arg, 1 retval), >but its blowing up on me. > > > DB<1> s >Uh oh - Bizarre copy of CODE in sassign at blib/lib//Devel/Size.pm line 42.
The PUSHMARK() XPUSHs() recipe only works for things that normally live on stack i.e. scalars. You can't XPUSHs an CV, AV, HV (You _may_ be able to push a GV.) Normal way to pass CV is a refrence. AV/HV are either passed by reference too, or flattened out into a list of many arguments. > >CV size = 160225208 >size of regular sub: 160225208 >main::(t/basic.t:76): my $sub = sub { print "hello world\n" }; > DB<1> > > >If you look at the patch, youll note my confusion wrt how to >pass params in this case. It seems to be different from the >perlcall recipe in ways I dont grok. > > >thx in advance >jimc