Such lovely discussion you have here. I feel like intervining ;)
> I have a file which contains four packages; the first is a base class
> and the other three are subclasses of it. The code runs fine but I'm
> getting warnings that the subroutines are redefined; I thought that
> was the whole purpose of subclassing!
Well, turns out you voided your warranty. Here comes my understanding.
AIII, that's what they call "Koo-Koo module" (in this case it's even
worse). Couple of years ago I've seen some calls for coming to senses
and cleaning CPAN of these nasties. Obviously, those fall on deaf ears.
Anyway, that's what happens:
Noramlly, you 'require' then manipulate '@ISA'. '
parent.pm', '
base.pm',
or whatever else combine these steps for you. Thus, whatever your
habits, 'require' is involved. In your CME you have shebang, that makes
it '.pl'. But your diagnostic says it's '.pm'. Your command-line says
you *run* '.pm' (what can possibly go wrong?). Then, perl does what you
told it to do: compile "A.pm", that module 'require's "A.pm" that hasn't
been compiled yet (perl is lazy here). That leads to redefinition of
subs that already have been compiled, then redefinition of subs that
have been compiled by 'require' after 'require' has finished (look for
yourself, first and second warning refer to fully qualified filename,
then third refers to filename as seen on command-line). Totaly normal,
nothing to see here. Just Perl doing it's thing :[
> I know I can put "no warnings redefine", but should I have to?
Well you have options:
* Do it properly -- one '.pm', one 'package'. Make ovid happy.
* Plug warnings with "no warnings qw/ redefine /". Make perl happy.
* Manipulate '@ISA' directly. Shoot yourself in foot sometime later.
* Search CPAN, probably there is something in support of Koo-Koo
modules, but I don't have any keywords to start with. Make yourself
busy.
* Did I miss something?
*SKIP*
> PS: there's something really weird going on, because "doodle" isn't
> even being subclassed and yet it still gets a warning.
I'm actualy surprised you haven't figured out all this by yourself. I
blame RL.
--
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom