I've got an application where I have an abstract class A, B inherits from A, and C inherits from B. Class P has-a C.
Class A uses 'base' Class::Accessor::Fast to create accessors. All classes A, B and C do __PACKAGE__->mk_accessors, to make their accessors.
The test suite ran fine over classes A, B and C. However, when I came to run the tests for P, perl would complain 'can't find package method mk_accessors in class C'.
If I added 'use base 'Class::Accessor' to C, the tests would run fine. But this violated the principle that C should only inherit from B.
I guessed that somehow at compile-time perl wasn't running all the way up the class hierarchy when importing package C. I figured that delaying the import until run-time would fix this problem.
I changed 'use C' to 'require C' and the problem was solved, with the tests for class P running fine.
But the question remains, why is perl (5.8.8) not running all the way up the class hierarchy when it imports classes? Or is it something to do with the implementation of Class::Accessor::Fast?
Hard to say... (Score:1)
Ordinary morality is for ordinary people. -- Aleister Crowley
Re:Hard to say... (Score:1)
Sure...Each of these are in a seperate file:
In the test suite:
use_ok('C') .... ok
In a seperate test file:
use_ok('P');
Fails 'Can't find package method mk_accessors via package 'C'.
On the other hand if I change P from 'use P' to 'require P' it works.