[Chicago-talk] is there a perl which?
lembark at wrkhors.com
Wed Feb 8 07:30:04 PST 2006
-- Jay Strauss <me at heyjay.com>
> On Wednesday 08 February 2006 12:25 am, Andy Lester wrote:
>> > Is there a function in Perl analygous to the Unix 'which', for
>> > saying where in
>> > the @INC it will find a package?
>> Before it finds it? Not that I know of. But after it's loaded, yes,
>> you look in %INC.
> I like your way better. I forgot about %INC.
For methods or derived modules the "can" operator
returns a coderef that can be converted into the
source module and line number:
my $subref = __PACKAGE__->can( 'frobnicate' );
my $subref = $pkg_name->can( $method );
my $subref = $blessed->can( $name );
can all be traced back to the source module and line
Steven Lembark 85-09 90th Street
Workhorse Computing Woodhaven, NY 11421
lembark at wrkhors.com 1 888 359 3508
More information about the Chicago-talk