grizzley has asked for the wisdom of the Perl Monks concerning the following question:
Inherited object:package mObject_T; use Moose; # automatically turns on strict and warnings has '_logicErrors' => (is => 'rw', isa => 'Str'); ...
I need second param of some function to be inherited from mObject_T, so I check if is_a("mObject_T"):package mSomeObject_T; extends mObject_T; ...
but contract fails, if I call function with inherited object:contract('checkName') ->in(is_a("mName_T"), is_a("mObject_T")) ->enable;
as is_a() gets 'mSomeObject_T' instead of 'mObject_T'. How to do it properly?my $obj = new mSomeObject_T; checkName($nameObj, $obj);
Thanks for any help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sub::Contract is_a inheritance problem
by ikegami (Patriarch) on Sep 09, 2008 at 09:01 UTC | |
by grizzley (Chaplain) on Sep 09, 2008 at 10:30 UTC |