The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Datify::Path - Describe structures like filesystem paths.

METHODS

new( name => value, name => value, ... )

Create a Datify::Path object with the following options.

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.

Can be called as a class method or an object method.

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.

See "OPTIONS" for a description of the options and their default values.

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( ... );

pathify( ... )

BUGS

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.

VERSION

This document describes version v0.20.064 of this module.

AUTHOR

Bob Kleemann <bobk@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2014-2020 by Bob Kleemann.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

SYNOPSIS

 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'/

DESCRIPTION

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.

TODO

SEE ALSO