File Coverage

blib/lib/Moose/Exception/ReferencesAreNotAllowedAsDefault.pm
Criterion Covered Total %
statement 5 5 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 7 7 100.0


line stmt bran cond sub pod time code
1             package Moose::Exception::ReferencesAreNotAllowedAsDefault;
2             our $VERSION = '2.2206';
3              
4 3     3   3132 use Moose;
  3         11  
  3         20  
5             extends 'Moose::Exception';
6             with 'Moose::Exception::Role::ParamsHash';
7              
8             has 'class' => (
9             is => 'ro',
10             isa => 'Str',
11             required => 1
12             );
13              
14             has 'attribute_name' => (
15             is => 'ro',
16             isa => 'Str',
17             required => 1
18             );
19              
20             sub _build_message {
21 8     8   14 my $self = shift;
22 8         297 "References are not allowed as default values, you must wrap the default of '".
23             $self->attribute_name."' in a CODE reference (ex: sub { [] } and not [])";
24             }
25              
26             __PACKAGE__->meta->make_immutable;
27             1;