I got email yesterday asking how to get a misused object to explain what methods it supports. Usually if you do $obj->fgsfds
all you get is Can't locate object method "fgsfds" via package "Thing"
. After a use Help 'Thing'
declaration, you get a list of methods supported by $obj
, and which class each one is inherited from.
This may not be too useful by itself, but the implementation is very interesting, because it is short (only 30 lines), it requires a large number of less-well-known Perl features, and its use of those features is not too tricky. So studying the implementation of this module is a great way to learn a several advanced features of Perl at once.
I posted the code of the Help.pm module with a detailed explanation of how it works.
In the past, I would have posted it here, but now that I have a blog, I posted it on my blog. But I thought some of you folks would be interested anyway, so I'm announcing it here.
Here it is. Enjoy!