use strict; use warnings; use diagnostics; use LFSR; my $nbits = 127; my $t = new LFSR($nbits); # Inherited constructor print ref($t),"\n"; # Shows it is a Bit::Vector, not an LFSR # More proof that $t is a Bit::Vector print $t->isa('Bit::Vector'),"\n"; print $t->isa('LFSR'),"\n"; # This line: # bless $t, "LFSR"; # Causes this error: # 'Modification of a read-only value attempted' #### package LFSR; use strict; use warnings; use diagnostics; use Bit::Vector; our @ISA = qw(Bit::Vector); # This also causes an error at the bless statement, # so I have it commented out. =pod sub new { my ($class, $nbits)= @_; my $self= new Bit::Vector($nbits); bless $self, $class; return $self; } =cut sub mine { my $self= shift; my $class= ref($self) || $self; print "Hello\n"; } 1;