Data-PrefixMerge

Merge two nested data structures recursively with merging mode prefix
on hash keys.

Some examples:

 # normal (replace) mode
 prefix_merge({a=>11, b=>12       },
              {       b=>22, *c=>23});
 # result:    {a=>11, b=>22, c=>23}

 # normal merging recursively merge hashes
 prefix_merge({a=>[11, 12], b=>2,  h=>{ i=>11, j=>{k=>11},        k=>12 }},
              {a=>21,     , b=>[], h=>{ i=>21, j=>{l=>21}               }});
 # result:    {a=>21,       b=>[], h=>{ i=>21, j=>{k=>11, l=>21}, k=>12 }

 # delete mode
 prefix_merge({  a =>1,       b =>2, c=>3 },
              {'!a'=>undef, '!b'=>2       });
 # result:    {                      c=>3 }

 # additive mode
 prefix_merge({  i =>1,   a =>[1]},
              {'+i'=>2, '+a'=>[1,2]});
 # result:    {  i =>3,   a =>[1,1,2]}

 # concat mode
 prefix_merge({  i =>1 ,   a =>[1]},
              {'.i'=>2 , '.a'=>[1,2]});
 # result:    {  i =>12,   a =>[1,1,2]}

 # subtract mode
 prefix_merge({  i =>1,   a =>[1,2,3]},
              {'-i'=>2, '-a'=>[2]});
 # result:    {  i =>-1,  a =>[1,3]}

 # keep mode
 prefix_merge({'!i'=>1},
              {  i =>2},
 # result:    {  i =>1}


INSTALLATION

To install this module, run the following commands:

	perl Makefile.PL
	make
	make test
	make install

SUPPORT AND DOCUMENTATION

After installing, you can find documentation for this module with the
perldoc command.

    perldoc Data::PrefixMerge

You can also look for information at:

    RT, CPAN's request tracker
        http://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-PrefixMerge

    AnnoCPAN, Annotated CPAN documentation
        http://annocpan.org/dist/Data-PrefixMerge

    CPAN Ratings
        http://cpanratings.perl.org/d/Data-PrefixMerge

    Search CPAN
        http://search.cpan.org/dist/Data-PrefixMerge/


COPYRIGHT AND LICENCE

Copyright (C) 2009 Steven Haryanto

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
