Is there a simple way to test if a Moose attribute is read-only?

Posted by molecules on Stack Overflow See other posts from Stack Overflow or by molecules
Published on 2010-04-01T18:41:21Z Indexed on 2010/04/01 18:43 UTC
Read the original article Hit count: 570

Filed under:
|
|
|
|

I currently use a block eval to test that I've set an attribute as read-only. Is there a simpler way to do this?

Example from working code:

#Test that sample_for is ready only
eval { $snp_obj->sample_for('t/sample_manifest2.txt');};
like($@, qr/read-only/xms, "'sample_for' is read-only");

© Stack Overflow or respective owner

Related posts about moose

Related posts about attributes