in reply to RE: Re: Interfaces
in thread Interfaces
I'd simplify the whole lot of that by doing what use subs does directly:sub cant_do_that { my $self = shift; print "Error: Use of undefined Abstract Method by $self.\n"; } use subs qw/methodOne methodTwo/; *methodOne = \&cant_do_that; *methodTwo = \&cant_do_that;
No fuss, no muss, and you even get a distinguishing mark.BEGIN { for my $fakir (qw(methodOne methodTwo)) { *$fakir = sub { die "undef abstract method $fakir used by ".(shift +); } } }
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: Re: Interfaces
by ivey (Beadle) on Jun 13, 2000 at 22:44 UTC |