use strict; use Test::More tests => 2; use Storable qw(dclone); use Struct::Diff qw/diff patch/; my $orig = { a => { b => [ 'c', 'd' ], e => [ [ 'f' ] ] } }; my $new = dclone($orig); my $delta = { D => { a => { D => { e => { D => [ { D => [ { O => 'f', N => 'g' } ] } ] } } } } }; patch ( $new, $delta ); my $augmented = { a => { b => [ 'c', 'd' ], e => [ [ 'g' ] ] } }; is_deeply( $new, $augmented, "augment" ); my $diff = diff( $orig, $new, noU => 1 ); is_deeply( $diff, $delta, "reduce" );