Hash::NoVivifyHash::NoVivify is a Perl extension for non-vivifying exists and defined functions. | |
Download |
Hash::NoVivify Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Brent B. Powers
- Publisher web site:
- http://search.cpan.org/~bpowers/Hash-NoVivify-0.01/NoVivify.pm
Hash::NoVivify Tags
Hash::NoVivify Description
Hash::NoVivify is a Perl extension for non-vivifying exists and defined functions. Hash::NoVivify is a Perl extension for non-vivifying exists and defined functions.SYNOPSIS use Hash::NoVivify qw(Defined Exists); ... if (Exists(%hash, qw(key1 key2 ... keyn ))) { ... } if (Defined(%hash, qw(key1 key2 ... keyn))) { ... }When used on a hash, the exists() and defined() functions will create entries in a hash in order to evaluate the function.For instance, the code: %a = (a => 1, b=> 2); print "Doesn't existn" unless exists($a{c}); print "Also Doesn't existn" unless exists($a{c}->{d}); print "Oh, my, not goodn" if exists($a{c});will print out: Doesn't exist Also Doesn't exist Oh, my, not goodThe Hash::NoVivify module provides two functions, Defined() and Exists(), which avoid this, at the cost of a slightly convoluted syntax. Both functions take a reference to a hash, followed by a list of descending keys defining the hash entry to be investigated. Requirements: · Perl
Hash::NoVivify Related Software