Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: (Solved?) Moose type-constraint is unhappy with defaults ... why?

by zwon (Abbot)
on Nov 24, 2011 at 16:06 UTC ( [id://939914]=note: print w/replies, xml ) Need Help??


in reply to (Solved?) Moose type-constraint is unhappy with defaults ... why?

First of all you're declaring type myOffset and then using MyOffset, note that case is different. Anyway, let's assume that's typo and you're using MyOffset everywhere. If you're declaring your attribute as

has my_offset => (is =>'rw', isa => 'MyOffset');
Moose will expect my_offset to be reference to 'MyOffset'. And it has no idea how to coerce this from integer. Now, if you're declaring your attribute as
has my_offset => (is =>'rw', isa => MyOffset);
it will call function MyOffset(), which returns "myTypes::MyOffset", so it is the same as if you'd write it as:
has my_offset => (is => 'rw', isa => "myTypes::MyOffset");
and myTypes::MyOffset may be coerced from integer.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://939914]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-20 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found