The BBC's loss is your gain! Today, due to heavy snow in London and severe delays on the Central Line, I was concerned about being able to get home after work. They let me leave early so I've been hacking on Class::Sniff. The latest version (0.04), on its way to the CPAN, now includes reporting and detection of exported "methods". Here's a sample report:
Report for class: Grandchild Overridden Methods .--------+--------------------------------------------------------------------. | Method | Class | +--------+--------------------------------------------------------------------+ | bar | Grandchild | | | Abstract | | | Child2 | | foo | Grandchild | | | Child1 | | | Abstract | | | Child2 | '--------+--------------------------------------------------------------------' Unreachable Methods .--------+--------------------------------------------------------------------. | Method | Class | +--------+--------------------------------------------------------------------+ | bar | Child2 | | foo | Child2 | '--------+--------------------------------------------------------------------' Multiple Inheritance .------------+----------------------------------------------------------------. | Class | Parents | +------------+----------------------------------------------------------------+ | Grandchild | Child1 | | | Child2 | '------------+----------------------------------------------------------------' Exported Subroutines .--------+---------+----------------------------------------------------------. | Class | Method | Exported From Package | +--------+---------+----------------------------------------------------------+ | Child1 | croak | Carp | | | inspect | Sub::Information | '--------+---------+----------------------------------------------------------'
Remember that class I mentioned which has 255 "methods" across 27 packages? I ran this code on it today (prior to "exported subroutine" detection) and excluded anything in the DBIx::Class namespace. It found 20 (twenty!) unreachable methods. Many of them were clearly things like 'longmess' which was exported from Carp, but still, it's a sign of a problem with the class.
I now have an idea for detecting "duplicate" methods. These happen when you cut-n-paste code. I'll go see if it works.