Subject: | Coat does not know about an extends class if the class has never been used |
All the examples of using 'extends' show situations where the class has
already been used. If we convert the Point example to have the modules
in separate files:
Point.pm:
package Point;
use Coat;
has 'x' => ( isa => 'Int', default => 0);
has 'y' => ( isa => 'Int', default => 0);
1;
Point3D.pm:
package Point3D;
use Coat;
extends 'Point';
has 'z' => ( isa => 'Int', default => 0);
1;
When you construct Point3D Coat reports:
Class 'Point' is unknown, cannot extends at
/usr/lib/perl5/site_perl/5.8.8/Coat.pm line 247
Coat::_extends_class('ARRAY(0x82f6ce4)', 'Point3D') called at
/usr/lib/perl5/site_perl/5.8.8/Coat.pm line 77
Coat::extends('Point') called at ...............
Changing the Point3D module to:
package Point3D;
use Coat;
use Point;
extends 'Point';
has 'z' => ( isa => 'Int', default => 0);
1;
Fixes the issue but this is not in-line with Moose's handling of the
situation which does not require the using Point.
I'm guessing if Coat does not know about an Object it should be
attempting to require/importing it first before extending it.