[libmoosex-lazyrequire-perl] 07/11: also die if a lazy_required sub has a default sub
Intrigeri
intrigeri at moszumanska.debian.org
Wed Aug 27 21:25:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to annotated tag v0.09
in repository libmoosex-lazyrequire-perl.
commit d8676ebccf3232ba1ee790ca7c108c70cc562eca
Author: Karen Etheridge <ether at cpan.org>
Date: Sat Dec 1 14:05:47 2012 -0800
also die if a lazy_required sub has a default sub
---
lib/MooseX/LazyRequire/Meta/Attribute/Trait/LazyRequire.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/MooseX/LazyRequire/Meta/Attribute/Trait/LazyRequire.pm b/lib/MooseX/LazyRequire/Meta/Attribute/Trait/LazyRequire.pm
index 891a810..96127ee 100644
--- a/lib/MooseX/LazyRequire/Meta/Attribute/Trait/LazyRequire.pm
+++ b/lib/MooseX/LazyRequire/Meta/Attribute/Trait/LazyRequire.pm
@@ -23,10 +23,12 @@ after _process_options => sub {
return unless $options->{lazy_required};
+ # lazy_required + default or builder doesn't make sense because if there
+ # is a default/builder, the reader will always be able to return a value.
Moose->throw_error(
"You may not use both a builder or a default and lazy_required for one attribute ($name)",
data => $options,
- ) if $options->{builder};
+ ) if $options->{builder} or $options->{default};
$options->{ lazy } = 1;
$options->{ required } = 1;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmoosex-lazyrequire-perl.git
More information about the Pkg-perl-cvs-commits
mailing list