Multiple inheritance of %FIELDS

Discussion in 'Perl Misc' started by Mintcake, May 13, 2006.

  1. Mintcake

    Mintcake Guest

    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.
     
    Mintcake, May 13, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. call_me_anything
    Replies:
    4
    Views:
    480
    Pete Becker
    Sep 30, 2007
  2. Cyril.Liu
    Replies:
    0
    Views:
    463
    Cyril.Liu
    Dec 2, 2008
  3. Rouslan Korneychuk
    Replies:
    8
    Views:
    616
    Rouslan Korneychuk
    Feb 10, 2011
  4. JP SIngh
    Replies:
    5
    Views:
    279
    Bob Barrows [MVP]
    Jan 24, 2006
  5. Replies:
    0
    Views:
    304
Loading...

Share This Page