[Bioperl-l] use base;

Hilmar Lapp hlapp at gmx.net
Mon May 9 04:36:08 EDT 2005


Perldoc says this has been present since 5.004 but unfortunately it 
doesn't work for multiple inheritance before 5.6.1, at least not on 
MacOSX. Test case attached.

I tracked this down when investigating the FeatureIO.t warnings.

I suggest that maybe we stick to the good old @ISA declaration - not 
terribly more lines of code and not terribly uglier, but has always 
worked.

	-hilmar
-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------

To test this, create a file Foo.pm with the following content:

package Foo;
use strict;
use base qw(Bio::Root::Root Bio::SeqFeatureI);
sub new { my $class = shift; my $self = bless {}, $class; return $self; 
}
1;

Then run the following command:

	$ perl -w -e 'use Foo; $foo = Foo->new(); if 
($foo->isa("Bio::SeqFeatureI")) { print "ok\n"; } else { print "not 
ok\n"; }'

This needs to print 'ok'. On 5.6.0 it will print 'not ok', but if you 
remove the Bio::Root::Root from the 'use base' instruction it will 
print 'ok'.



More information about the Bioperl-l mailing list