Martyn J. Pearce <fluffy@sixears.co.uk> writes: >Greetings Porters, > >I have a slightly unusual(?) requirement with Perl/XS that you may be able to >help with. > >In the Class::MethodMaker module that I maintain, methods are created on the >fly and inserted into the clients namespace using a glob assignment from an >anonymous coderef (that may or may not be a closure). > >The issue is that when debugging or profiling, all such methods are referred >to as 'Class::MethodMaker::__ANON__', because that's where the code is >compiled. The only Perl method I can think of around would involve string >evals, which are unnacceptably slow (and lose an element of compile-time >checking). So what do you want to see there? I ask as when closures are involved faking things up is more tricky. >So my questions are: > >1) Am I missing a pure perl option? > >2) Am I right to think that it is possible with XS? XS bcomes C code, perl core is C code - anything core can do XS can do. Downside is that sometimes you have to know a lot more about internals than is otherwise necessary, documented or stable. > >3) Can you please give me a pointer as to where to start? Look at code that debugger/profiler uses to print the problem string and figure out what slot of what needs to get changed. You may be in trouble though - the "name" usually comes from the GV (glob) and you may not have (a unique) one. So then you need to start creating them and hooking them into other data structures - if you don't get that "right" you may get cores.Thread Previous | Thread Next