in reply to use base qw(Dazed Confused)

Well, I get the same results as you.

But I am curious about one thing, Why are you doing this? Importing the UNIVERSAL method like that is odd. UNIVERSAL::isa() is an OO method. Anything that isn't a blessed object should be handled with ref, blessed objects have UNIVERSAL::isa as a method, and it should be called as such:

use strict; use CGI; my $q = CGI->new(); # $q now "isa" CGI object. print $q->isa( 'CGI' ) ? "Yes it is\n" : "Nope\n"; print $q->isa( 'DBI' ) ? "Yes it is\n" : "Nope\n";

Replies are listed 'Best First'.
Re: Re: use base qw(Dazed Confused)
by MeowChow (Vicar) on Jan 30, 2001 at 06:14 UTC
    LOL, I knew someone would ask that eventually :) Well, I have a function that takes a parameter of any sort (array ref, string, hash, object, etc...), and depending on the type of the param, it does different things. Without knowing if the parameter has been blessed or not, I cannot say:
    $param->isa('Foo')
    since that can return an error. So instead, I have to use:
    UNIVERSAL::isa($param, 'Foo');
    Which is, of course, alot to type, hence the alias.

    Update: Oh, and I forgot to mention that it wasn't exactly my idea:

    These subroutines should not be imported via use UNIVERSAL qw(...). If you want simple local access to them you can do *isa = \&UNIVERSAL::isa; to import isa into your package.
    That was taken from the <cough> UNIVERSAL.pm documentation ;)