develooper Front page | perl.perl5.porters | Postings from October 2003

Setting the Compiled Name by Hand

Thread Next
Martyn J. Pearce
October 2, 2003 02:22
Setting the Compiled Name by Hand
Message ID:
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

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)

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... :-)


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About