|Keep It Simple, Stupid|
Avoiding the Use of @ISA = qw(Foo::Bar);by hardburn (Abbot)
|on Jul 14, 2003 at 17:46 UTC||Need Help??|
How many modules have you run across that do this?
I believe that clobbering @ISA is wrong (though I'm occasionally guilty of it myself). The problem arises in that we sometimes may not know how @ISA has been modified before we clobber it. This is highly unlikely in the example above, but it could be an issue in a more complex class. Even if our current class won't give us problems, future changes could create problems.
Fortunatly, the use base pragma is just as easy to code for:
base will take care of munging @ISA for us, and has the additional effect of requireing the inherited package for us.
So please, leave @ISA alone. It might feel good, but it could bite you in the long run.
Note: All code is untested, unless otherwise stated