Multiple inheritance of %FIELDS

M

Mintcake

There are 5 small files in this example:

foo.pl: use p4;
p1.pm: package p1; use fields qw(a b); 1;
p2.pm: package p2; use base 'p1'; 1;
p3.pm: package p3; use base 'p1'; 1;
p4.pm: package p4; use base qw(p2 p3); 1;

When I compile foo.pl I get the following error:

Can't multiply inherit %FIELDS at /home/tony/Projects/bin/p4.pm line 1

Now I can see that if both p2 and p3 had introduced additional fileds
then they would occupy the same space and cause potential runtime
confusion. But, if only one of the packages p2 and p3 introduced
additional fields or (as in the above example) neither of them did, it
ought to work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top