in reply to Re: if (UNIVERSAL::isa($r, ref $l))
in thread if (UNIVERSAL::isa($r, ref $l))
Hey, I edited that.
I really don't see what advantage __PACKAGE__ has over a hardcoded class name except that it's Pythonesquely uglier.
Alright, I can hear dozens of keyboards getting ready to type "What about inheritance, you dope?" Before you get excited, try this little program:
package Foo; sub new { bless {}, __PACKAGE__; } package Bar; use vars qw( @ISA ); @ISA = 'Foo'; package main; my $bar = Bar->new(); print "Bar is a ", ref $bar, "\n";
Yep, the package into which it's compiled. Nope, not all that useful. Pity.
Update: Okay, if you don't like hardcoding the class name, there's an advantage. The Class module gets rid of the ugliness. That's kinda useful.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: if (UNIVERSAL::isa($r, ref $l))
by demerphq (Chancellor) on Jul 24, 2003 at 07:25 UTC | |
|
Re^3: if (UNIVERSAL::isa($r, ref $l))
by adrianh (Chancellor) on Jul 24, 2003 at 10:17 UTC | |
by demerphq (Chancellor) on Jul 25, 2003 at 00:06 UTC |