libperlx-maybe-perl

Return a pair only if they are both defined
  https://metacpan.org/release/PerlX-Maybe
  0
  no reviews



Moose classes (and some other classes) distinguish between an attribute being unset and the attribute being set to undef. supplying a constructor arguments like this:

my $bob = person->new(
name => $name,
age => $age,
);
will result in the "name" and "age" attributes possibly being set to undef (if the corresponding $name and $age variables are not defined), which may violate the person class' type constraints.

perlx::maybe checks that $x and $y are both defined. if they are, it returns them both as a list; otherwise it returns the empty list.

this package also includes syntax::feature::maybe.