develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [patch] small lib.pm bufgixes

Thread Previous | Thread Next
From:
Benjamin Goldberg
Date:
February 26, 2003 22:06
Subject:
Re: [patch] small lib.pm bufgixes
Message ID:
3E5DADC5.D8CA95AE@earthlink.net
Alex Vandiver wrote:
[snip]
>   Finally, I added a catch so that CODE blocks which are inserted into
> @INC don't get treated as strings.

Coderefs are not the only refs allowed in @INC -- you can put in an
arrayref or a blessed refs, too.

Coderefs get called as $ref->($ref, $file).  Arrayrefs get called as
$ref->[0]->($ref, $file).  Blessed refs get called as $ref->INC($file).

So instead of using 'if UNIVERSAL::isa($path, "CODE")', you should
probably just do 'if ref $path'.

(This is the second time in two weeks that I've seen someone write code
with the believe that coderefs are the only type of ref which can go
into @INC ... I would love to know where this misconception came from.)

-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About