NAME

Struct::Path - Path for nested structures where path is also a structure

VERSION

Version 0.12

SYNOPSIS

use Struct::Path qw(spath);

$s = [
    0,
    1,
    {2a => {2aa => '2aav', 2ab => '2abv'}},
    undef
];

@r = spath($s, [ [3,0,1] ]);
# @r == (\undef, \0, \1)

@r = spath($s, [ [2],{2a => undef},{} ]);
# @r == (\2aav, \2abv)

${$r[0]} =~ s/2a/blah-blah-/;
# $s->[2]{2a}{2aa} == "blah-blah-av"

EXPORT

Nothing exports by default.

SUBROUTINES

spath

Returns list of references from structure.

@list = spath($struct, $path, %opts)

Available options

delete

Delete specified by path items from structure if set to true value.

deref

Dereference result items if set to some true value.

expand

Expand structure if specified in path items does't exists. All newly created items initialized by undef.

strict

Croak if at least one element, specified in path, absent in the struct.

LIMITATIONS

No object oriented interface provided.

AUTHOR

Michael Samoglyadov, <mixas at cpan.org>

BUGS

Please report any bugs or feature requests to bug-struct-path at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Struct-Path. 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 Struct::Path

You can also look for information at:

SEE ALSO

Data::Diver Data::DPath Data::DRef Data::Focus Data::Hierarchy Data::Nested Data::PathSimple Data::Reach Data::Spath JSON::Path MarpaX::xPathLike Sereal::Path

Struct::Diff

LICENSE AND COPYRIGHT

Copyright 2016 Michael Samoglyadov.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.