|Just another Perl shrine|
How can I inherit from Bit::Vector?by toma (Vicar)
|on Nov 04, 2001 at 23:50 UTC||Need Help??|
toma has asked for the
wisdom of the Perl Monks concerning the following question:
My goal is to add new functionality to Bit::Vector without changing its source code. My strategy has been to make my own class that inherits from Bit::Vector, but it is resisting my strategy.
How can I make inheritance work with Bit::Vector? If inheritance won't work, what approach should I use?
The error message I get is 'Modification of a read-only value attempted' when I try to re-bless the Bit::Vector. If I don't re-bless, I get a Bit::Vector where I expect an LFSR object.
Here is my attempt so far:
The stripped-down module:
I am running perl version 5.6.1.
It should work perfectly the first time! - toma