I would use Carp::confess in this case. And I probably wouldn't check if the method was overloaded on new(). Please consider the following example:
package MyPackage; use strict; use warnings; use Carp qw(confess); sub new { my ($class) = @_; my $self = {}; bless $self, $class; return $self; } sub abstract_method { my ($self) = @_; my ($method) = ( caller(0) )[3]; confess "${method} should be overloaded."; } package main; my $p = MyPackage->new(); $p->abstract_method();
Don't you think it is cleaner?
Igor 'izut' Sutton
your code, your rules.
In reply to Re^2: Inheritance and calling a subclass method *from* a baseclass method...
by izut
in thread Inheritance and calling a subclass method *from* a baseclass method...
by EvanK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |