Parse and validate simple name/value option pairs
Hashes are great for storing named data, but if you want more than one
entry for a name, you have to use a list of pairs. Even then, this is
really boring to write:
$values = [
foo => undef,
bar => undef,
baz => undef,
xyz => { ... },
];
Just look at all those undefs! Don't worry, we can get rid of those:
$values = [
map { $_ => undef } qw(foo bar baz),
xyz => { ... },
];
Aaaauuugh! We've saved a little typing, but now it requires thought to
read, and thinking is even worse than typing.
With Data::OptList, you can do this instead:
$values = Data::OptList::mkopt([
qw(foo bar baz),
xyz => { ... },
]);
This works by assuming that any defined scalar is a name and any
reference following a name is its value.
Author: Ricardo SIGNES,
- Download package
-
Checkout Package
osc -A https://api.opensuse.org checkout openSUSE:Leap:42.1/perl-Data-OptList && cd $_
- Create Badge
Source Files
Filename | Size | Changed |
---|---|---|
Data-OptList-0.109.tar.gz | 0000016110 15.7 KB | |
perl-Data-OptList.changes | 0000001789 1.75 KB | |
perl-Data-OptList.spec | 0000002876 2.81 KB |
Revision 1 (latest revision is 2)
osc copypac from project:SUSE:SLE-12:GA package:perl-Data-OptList revision:9d4a128138dbb3b2f4643c8f191e7fc2, using expand
Comments 0