From 209100060d31fc0ac64676dea89adb6b8b0c1fb5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 21 Feb 2011 01:18:10 -0600 Subject: die if a default is set in a service attribute --- lib/MooseX/Bread/Board/Meta/Role/Attribute.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/MooseX/Bread/Board/Meta/Role/Attribute.pm b/lib/MooseX/Bread/Board/Meta/Role/Attribute.pm index 9f4c16e..c6c1335 100644 --- a/lib/MooseX/Bread/Board/Meta/Role/Attribute.pm +++ b/lib/MooseX/Bread/Board/Meta/Role/Attribute.pm @@ -83,6 +83,18 @@ after attach_to_class => sub { $meta->add_service($service); }; +after _process_options => sub { + my $class = shift; + my ($name, $opts) = @_; + + return unless exists $opts->{default}; + return unless exists $opts->{class} + || exists $opts->{block} + || exists $opts->{value}; + + die "default is not valid when Bread::Board service options are set"; +}; + around get_value => sub { my $orig = shift; my $self = shift; -- cgit v1.2.3-54-g00ecf