On 15.11.2012 17:15, Toby Inkster via RT wrote:
Show quoted text> * name - the name of the sub, or undef
Can be done with Sub::Identify.
Show quoted text> * body - the coderef
I don't think this should be in there, for the following reasons:
- the Info object is looked up by coderef, so you already have that
information
- Potential memory leak if the metadata hash keeps all subs alive
- the Info => coderef mapping isn't unique (if you have multiple
closures built from the same physical code, they share their Info objects)
Show quoted text> * attributes - the attributes declared if any. Not sure what level of
> parsing I'd expect Function::Parameters::Info to have done. The minimal
> probably.
Can be done with attributes::get.
Show quoted text> * prototype - the prototype for the function. Yes, Perl has a built-in
> for this... but for completeness. :-)
Can be done with prototype.
Show quoted text> A "keyword" method telling you what keyword was used to declare the sub
> also seems obvious, but actually I think that should be deliberately
> omitted. It's an implementation detail. If people want to use different
> keywords to classify different types of subs, they can give each
> keyword an attribute.
Already implemented. :-)
It's just not documented for the reasons you've given, but I thought it
might be useful for debugging.
The way I see it, you can implement most of this functionality by
wrapping Info in your own class and delegating to it.