How to Install and Uninstall perl-PerlX-Maybe Package on openSuSE Tumbleweed
Last updated: November 07,2024
1. Install "perl-PerlX-Maybe" package
In this section, we are going to explain the necessary steps to install perl-PerlX-Maybe on openSuSE Tumbleweed
$
sudo zypper refresh
Copied
$
sudo zypper install
perl-PerlX-Maybe
Copied
2. Uninstall "perl-PerlX-Maybe" package
Please follow the steps below to uninstall perl-PerlX-Maybe on openSuSE Tumbleweed:
$
sudo zypper remove
perl-PerlX-Maybe
Copied
3. Information about the perl-PerlX-Maybe package on openSuSE Tumbleweed
Information for package perl-PerlX-Maybe:
-----------------------------------------
Repository : openSUSE-Tumbleweed-Oss
Name : perl-PerlX-Maybe
Version : 1.202-1.10
Arch : noarch
Vendor : openSUSE
Installed Size : 50.1 KiB
Installed : No
Status : not installed
Source package : perl-PerlX-Maybe-1.202-1.10.src
Upstream URL : https://metacpan.org/release/PerlX-Maybe
Summary : Return a pair only if they are both defined
Description :
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.
(Note: if you are the _author_ of the class in question, you can solve this
using MooseX::UndefTolerant. However, some of us are stuck using
non-UndefTolerant classes written by third parties.)
To ensure that the Person constructor does not try to set a name or age at
all when they are undefined, ugly looking code like this is often used:
my $bob = Person->new(
defined $name ? (name => $name) : (),
defined $age ? (age => $age) : (),
);
or:
my $bob = Person->new(
(name => $name) x!!(defined $name),
(age => $age) x!!(defined $age),
);
A slightly more elegant solution is the 'maybe' function.
-----------------------------------------
Repository : openSUSE-Tumbleweed-Oss
Name : perl-PerlX-Maybe
Version : 1.202-1.10
Arch : noarch
Vendor : openSUSE
Installed Size : 50.1 KiB
Installed : No
Status : not installed
Source package : perl-PerlX-Maybe-1.202-1.10.src
Upstream URL : https://metacpan.org/release/PerlX-Maybe
Summary : Return a pair only if they are both defined
Description :
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.
(Note: if you are the _author_ of the class in question, you can solve this
using MooseX::UndefTolerant. However, some of us are stuck using
non-UndefTolerant classes written by third parties.)
To ensure that the Person constructor does not try to set a name or age at
all when they are undefined, ugly looking code like this is often used:
my $bob = Person->new(
defined $name ? (name => $name) : (),
defined $age ? (age => $age) : (),
);
or:
my $bob = Person->new(
(name => $name) x!!(defined $name),
(age => $age) x!!(defined $age),
);
A slightly more elegant solution is the 'maybe' function.