Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Moose type constraint failure

by CountZero (Bishop)
on Feb 05, 2013 at 22:36 UTC ( #1017292=note: print w/ replies, xml ) Need Help??


in reply to Moose type constraint failure

It works for me. The module:

use Modern::Perl; package Testing; use Bit::Vector; use Moose; has 'thing' => ( isa => 'Bit::Vector', is => 'rw', default => sub { return Bit::Vector->new(32); }, ); no Moose; __PACKAGE__->meta->make_immutable; 1;
And calling it:
use Modern::Perl; use Testing; use Data::Dump qw/dump/; my $object = Testing->new; say dump($object);
output:
bless({ thing => bless(do{\(my $o = 39557684)}, "Bit::Vector") }, "Tes +ting")
To reproduce your error, I have to initialize the object as follows:
my $object = Testing->new({thing => undef});

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics


Comment on Re: Moose type constraint failure
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-07-25 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls