summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-02-21 01:18:10 -0600
committerJesse Luehrs <doy@tozt.net>2011-02-21 01:18:10 -0600
commit209100060d31fc0ac64676dea89adb6b8b0c1fb5 (patch)
tree910a72932aec72628cab82b4e77ada16c20ee7de /lib
parenteeb792decae28e85e487ebeeb6d56f1994b56c62 (diff)
downloadbread-board-declare-209100060d31fc0ac64676dea89adb6b8b0c1fb5.tar.gz
bread-board-declare-209100060d31fc0ac64676dea89adb6b8b0c1fb5.zip
die if a default is set in a service attribute
Diffstat (limited to 'lib')
-rw-r--r--lib/MooseX/Bread/Board/Meta/Role/Attribute.pm12
1 files changed, 12 insertions, 0 deletions
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;