| Class-Can documentation | Contained in the Class-Can distribution. |
Class::Can - inspect a class/method and say what it can do (and why)
use Class::Can;
print Dumper { Class::Can->interrogate( 'Class::Can' ) };
__END__
$VAR1 = {
'interrogate' => 'Class::Can'
};
Class::Can interrogates the object heirarchy of a package to return a hash detailling what methods the class could dispatch (as the key), and the package it found it in (as the value).
Richard Clamp <richardc@unixbeard.net>
Copyright 2004 Richard Clamp. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Class::ISA, Devel::Symdump
| Class-Can documentation | Contained in the Class-Can distribution. |
package Class::Can; use strict; use warnings; use Class::ISA; use Devel::Symdump; our $VERSION = 0.01;
sub interrogate { my ($self, $class) = @_; my %can; for my $package (reverse Class::ISA::self_and_super_path( $class )) { my @methods = Devel::Symdump->new( $package )->functions; s{.*::}{} for @methods; @can{ @methods } = ($package) x @methods; } return %can; } 1;