freebsd-ports/devel/p5-PerlX-Maybe/pkg-descr
Adam Weinberger 2141febc1d Add devel/p5-PerlX-Maybe, "return a pair only if they are both defined",
needed to update devel/p5-App-GitGot.
2015-02-25 18:23:31 +00:00

8 lines
360 B
Text

Moose classes (and some other classes) distinguish between an attribute being
unset and the attribute being set to undef.
To ensure that the Person constructor does not try to set a name or age at all
when they are undefined, ugly looking code is often used. A slightly more
elegant solution is the maybe function.
WWW: https://metacpan.org/pod/PerlX::Maybe