in reply to Re: returning filename of module used
in thread returning filename of module used

Note that %INC (and likely @INC) is actually a global global. That is, it is available in every package:

package Foo; sub whence { my $fp = shift; $fp =~ s=::=/=g; $fp .= '.pm'; $INC{$fp} } package main; use warnings; print Foo::whence('warnings'),$/;
Works just fine. ;-) I make minor changes to your example because I didn't use a "normally named" package to put whence into.