I should also mention if you want to be able to change the Type
internally, but not expose it as part of the public API, you could use
a private writer method (prefixed with _). See the "reader" and
"writer" properties of attributes.
--
Oliver Charles / aCiD2
On Tue, Jun 15, 2010 at 7:17 PM, Stephen Prytherch
wrote:
> Hello,
> I have small problem. I define a class 'Node' with 2 enums Action and State
> and when creating an instance it enforces constraints correctly. However
> once I’ve created an instance it doesn’t seem to enforce constraints.
>
> ..
On Jun 15, 2010, at 2:17 PM, Stephen Prytherch wrote:
package main;
my $btn = HtmlElement->new( Name => 'myButton', Type => 'Button');
$btn->{Type}='An Illegal Value';
You need to call the ->Type method, if you directly access the
underlying HASHref then you are bypassing Moose.
- Steva
Hello,
I have small problem. I define a class 'Node' with 2 enums Action and State
and when creating an instance it enforces constraints correctly. However
once I’ve created an instance it doesn’t seem to enforce constraints.
At the end of the following code if I dump $btn I see:
DB<5> x $btn