Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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);
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});


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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017292]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2017-08-17 08:10 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (284 votes). Check out past polls.