That's all good and dandy, but even tough your module looks useful (and generic), I can't say I like the resulting interface — i.e. the use statement. I'd rather see something like this:
use strict;
package Foo;
use isa qw(Bar);
sub new { bless {},shift }
The module isa.pm can actually quite short:
# file isa.pm
package isa;
sub import {
my $pkg = shift;
my $caller = caller;
no strict 'vars';
push @{"$caller\::ISA"}, @_;
}
42;
Et voilà:
foo is a Bar
Of course, with base doing the same and more, I don't know if there's much need for this here module.
|