in reply to Abstract Packages

I'll give you merlyn's "don't do my $class = ref($obj) || $obj" advice. Don't do it.

When I need abstract methods, I usually do:

sub some_abstract_method { __abstract($_[0], caller); # ... } sub __abstract { my ($thing, $pkg, $file, $line) = @_; return if $thing ne __PACKAGE__; my $func = (caller 1)[3]; die "$func is abstract; in $file line $line\n"; }
Same general principle, but I think it's a little cleaner.
_____________________________________________________
Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: Abstract Packages
by Velaki (Chaplain) on Aug 05, 2004 at 11:47 UTC

    For abstract methods, that's practically the same as the code I use. The code I posted was for abstract classes, although I could see how you could always make the constructor abstract, and handle it from there.

    -v
    "Perl. There is no substitute."