UNIVERSAL::which - tells fully qualified name of the method
$Id: which.pm,v 0.5 2007/05/15 14:54:00 dankogai Exp $
use UNIVERSAL::which; use Some::Sub::Class; # which inherits lots of modules # .... my $o = Some::Sub::Class->new; # in scalar context my $fqn = $o->which("method"); # in list context my ($pkg, $name) = $o->which("method"); # as function my $fqn = UNIVERSAL::which('Some::Sub::Class', 'method');
UNIVERSAL::which provides only one method, which.
which
As the name suggests, it returns the fully qualified name of a given method. Sometimes you want to know the true origin of a method but inheritance and AUTOLOAD gets in your way. This module does just that.
t/*.t illustrates how UNIVERSAL::which behaves more in details.
perlobj, UNIVERSAL::canAUTOLOAD
Dan Kogai, <dankogai at dan.co.jp> http://search.cpan.org/~dankogai/
Original idea seeded by: TANIGUCHI http://search.cpan.org/~taniguchi/
B::svref_2object trick by: HIO http://search.cpan.org/~hio/
AUTOLOAD case suggested by: DAIBA http://search.cpan.org/~daiba/
Anon. coderef bug noted by: MIYAZAKI http://search.cpan.org/~miyazaki/
Copyright (C) 2006-2007 by Dan Kogai
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install UNIVERSAL::which, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UNIVERSAL::which
CPAN shell
perl -MCPAN -e shell install UNIVERSAL::which
For more information on module installation, please visit the detailed CPAN module installation guide.