develooper Front page | perl.perl5.porters | Postings from January 2007

Fwd: New release ?

Thread Previous | Thread Next
Brandon Black
January 5, 2007 15:52
Fwd: New release ?
Message ID:
[oops, resend to list]

On 1/5/07, Rafael Garcia-Suarez <> wrote:
> On 06/01/07, Brandon Black <> wrote:
> > However, ->isa checks for those superclasses fail.  Attached is a
> > short perl script that demonstrates what I'm talking about, which
> > seems rather inconsistent.  Is this inconsistency something we want to
> > preserve for historical reasons, or should it be remedied (I could do
> > that either as a separate patch or as part of the c3 patch since it
> > touches on this code anyways).
> I don't know -- I suspect some code might rely on this too. The usual
> suspect would be in the UNIVERSAL:: namespace on CPAN. Also, since the
> superclasses of UNIVERSAL will also be subclasses of UNIVERSAL too,
> won't this be a risk of infinite recursion ?

It doesn't cause infinite recursion in method lookup, and the same
basic strategy can be used for isa lookup.  The method lookup strategy
boils down to "recurse through @ISA looking for the method, then if
that fails, look at UNIVERSAL and recurse into its @ISA".  The jump to
UNIVERSAL happens once explicitly, and then never again.

One can currently exploit this and make an infinite loop by putting
UNIVERSAL into the @ISA of a class in @UNIVERSAL::ISA, but then the
normal infinite loop catcher (the one that deals with normal classes
being their own parents) kicks in after 100 levels of recursion and

I can't imagine what code on CPAN would rely on the
->isa('SUPERCLASS_OF_UNIVERSAL') check failing (then again, apparently
nobody expected it to succeed either or someone would have mentioned
this before).

-- Brandon

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About