NAME

DataStruct::Flat - Convert a data structure into a one level list of keys and values

SYNOPSIS

  use DataStruct::Flat;

  my $flattener = DataStruct::Flat->new;

  my $flat = $flattener->flatten({
    a => [ 7, 8, 9, 10 ],
    b => { c => d },
  });

  # $flat = {
  #   'a.0' => 7,
  #   'a.1' => 8,
  #   'a.2' => 9,
  #   'a.3' => 10,
  #   'b.c' => 'd'
  # };

DESCRIPTION

This module converts a nested Perl data structure into a one level hash of keys and values apt for human consumption.

METHODS

new

Constructor. Initializes the flattener object

flatten($struct)

Returns a hashref for $struct which contains keys with dotted "paths" to the respective values in the datastructure.

CONTRIBUTE

The source code is located here: https://github.com/pplu/datastruct-flat

SEE ALSO

Hash::Flatten

AUTHOR Jose Luis Martinez CPAN ID: JLMARTIN CAPSiDE jlmartinez@capside.com http://www.pplusdomain.net

COPYRIGHT

Copyright (c) 2019 by CAPSiDE

LICENSE

Apache 2.0