Datify::Path - Describe structures like filesystem paths.
new( name => value, name => value, ... )
Create a Datify::Path object with the following options.
Datify::Path
See "OPTIONS" for a description of the options and their default values.
exists( name, name, ... )
Determine if values exists for one or more settings.
Can be called as a class method or an object method.
get( name, name, ... )
Get one or more existing values for one or more settings. If passed no names, returns all parameters and values.
set( name => value, name => value, ... )
Change the "OPTIONS" settings. When called as a class method, changes default options. When called as an object method, changes the settings and returns a new object.
NOTE: When called as a object method, this returns a new instance with the values set, so you will need to capture the return if you'd like to persist the change:
$datify = $datify->set( ... );
Please report any bugs or feature requests on the bugtracker website https://github.com/rkleemann/Datify/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
This document describes version v0.20.064 of this module.
Bob Kleemann <bobk@cpan.org>
This software is Copyright (c) 2014-2020 by Bob Kleemann.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
use Datify::Path; my $pathify = Datify::Path->new(); say foreach $pathify->pathify( [ qw( this that the-other ) ] ); # [1/3] = this # [2/3] = that # [3/3] = 'the-other' say foreach $pathify->pathify( { a => 100, b => 1024, c => 102030 } ); # /a = 100 # /b = 1_024 # /c = 102_030 say foreach $pathify->pathify( { array => [ 1, 10, 100, 10000, 100_000_000 ], hash => { a => 'alpha', b => 'bravo', c => undef }, nested => [ { '!@#$%^&*()' => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ] }, { '' => 'empty string' }, { " \t\n" => 'space, tab, & newline' }, { 'empty array' => [] }, { 'empty hash' => {} }, ], } ); # /array[1/5] = 1 # /array[2/5] = 10 # /array[3/5] = 100 # /array[4/5] = 10_000 # /array[5/5] = 100_000_000 # /hash/a = alpha # /hash/b = bravo # /hash/c # /nested[1/4]/'!@#$%^&*()'[ 1/10] = 1 # /nested[1/4]/'!@#$%^&*()'[ 2/10] = 2 # /nested[1/4]/'!@#$%^&*()'[ 3/10] = 3 # /nested[1/4]/'!@#$%^&*()'[ 4/10] = 4 # /nested[1/4]/'!@#$%^&*()'[ 5/10] = 5 # /nested[1/4]/'!@#$%^&*()'[ 6/10] = 6 # /nested[1/4]/'!@#$%^&*()'[ 7/10] = 7 # /nested[1/4]/'!@#$%^&*()'[ 8/10] = 8 # /nested[1/4]/'!@#$%^&*()'[ 9/10] = 9 # /nested[1/4]/'!@#$%^&*()'[10/10] = 0 # /nested[2/4]/'' = 'empty string' # /nested[3/4]/" \t\n" = 'space, tab, & newline' # /nested[4/4]/'empty array'[0/0] # /nested[4/4]/'empty hash'/
Datify::Path will convert a data structure consisting of arrays, hashes, and scalars into a form similar to a path listing. This can be useful when searching for a particular value, then finding the "path" that leads to it.
To install Datify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Datify
CPAN shell
perl -MCPAN -e shell install Datify
For more information on module installation, please visit the detailed CPAN module installation guide.