Skip to content

Access perl nested hash structures without vivification

Notifications You must be signed in to change notification settings

dcsjulio/Hash-Digger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions Status

NAME

Hash::Digger - Access nested hash structures without vivification

VERSION

Version 0.0.5

SYNOPSIS

Allows accessing hash structures without triggering autovivification.

my %hash;

$hash{'foo'}{'bar'} = 'baz';

diggable \%hash, 'foo', 'bar';
# Truthy

diggable \%hash, 'xxx', 'yyy';
# Falsey

dig \%hash, 'foo', 'bar';
# 'baz'

dig \%hash, 'foo', 'bar', 'xxx';
# undef

exhume 'some default', \%hash, 'foo', 'bar';
# 'baz'

exhume 'some default', \%hash, 'foo', 'xxx';
# 'some default'

# Hash structure has not changed:
use Data::Dumper;
Dumper \%hash;
# $VAR1 = {
#           'foo' => {
#                      'bar' => 'baz'
#                    }
#         };

EXPORT

dig, diggable, exhume

SUBROUTINES/METHODS

diggable

Check if given path is diggable on the hash (`exists` equivalent)

dig

Dig the hash and return the value. If the path is not valid, it returns undef.

exhume

Dig the hash and return the value. If the path is not valid, it returns a default value.

REPOSITORY

https://github.com/juliodcs/Hash-Digger

AUTHOR

Julio de Castro, <julio.dcs at gmail.com>

BUGS

Please report any bugs or feature requests to bug-hash-digger at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hash-Digger. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Hash::Digger

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2020 by Julio de Castro.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

About

Access perl nested hash structures without vivification

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages