"Martyn J. Pearce" <fluffy@sixears.co.uk> wrote: > 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). > > However, I figure that it must be possible to reset the relevant name with a > little XS code. Unfortunately, I'm very much into uncharted waters (for me) > here. > > So my questions are: > > 1) Am I missing a pure perl option? > > 2) Am I right to think that it is possible with XS? > > 3) Can you please give me a pointer as to where to start? > > Obviously complete solutions are welcome too, but I don't want to be *too* > presumptious... :-) > Try to set the $DB::sub variable: my $sub = sub { $DB::sub = "namedsub"; ... }; Regards, Slaven -- Slaven Rezic - slaven <at> rezic <dot> deThread Previous | Thread Next