projects
/
gitmo/Moo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
correct coerce example in pod
[gitmo/Moo.git]
/
lib
/
Moo.pm
diff --git
a/lib/Moo.pm
b/lib/Moo.pm
index
f5737fd
..
6bf3fc0
100644
(file)
--- a/
lib/Moo.pm
+++ b/
lib/Moo.pm
@@
-529,7
+529,7
@@
Takes a coderef which is meant to coerce the attribute. The basic idea is to
do something like the following:
coerce => sub {
- $_[0] + 1 unless $_[0] % 2
+ $_[0] % 2 ? $_[0] : $_[0] + 1
},
Note that L<Moo> will always fire your coercion: this is to permit