|
NAMEHash::Union - smart hashes mergingVERSIONVersion 0.03SYNOPSISuse Hash::Union 'union'; use Data::Dumper; # for debug only my $config_base = { # default application config 'database' => 'production', # production database 'html_dirs' => [ # search paths for html documents '/docs/html/main', '/docs/html/default' ], 'text_dirs' => [ # search paths fo text documents '/docs/text/main', '/docs/text/default' ] }; my $config_local = { # locally customized config 'database' => 'stageing', # devel database 'prepend: html_dirs' => [ # local html pages preferred '/local/html/main', '/local/html/default' ], 'append: text_dirs' => [ # fallback for nonexistent text '/local/text/main', '/local/text/default' ] }; # now merge default with local my $config = union( [ $config_base, $config_local ] ); print Dumper $config; ======== $VAR1 = { 'database' => 'stageing', 'html_dirs' => [ '/local/html/main', '/local/html/default', '/docs/html/main', '/docs/html/default' ], 'text_dirs' => [ '/docs/text/main', '/docs/text/default', '/local/text/main', '/local/text/default' ] }; EXPORT_OKunion( \@hash_references, %options );Supported options:
KEYS SPECIAL MEANING
NOTE: In all syntax forms spaces between operation and key are optional. AUTHOROleg A. Mamontov, "<oleg at mamontov.net>"BUGSPlease report any bugs or feature requests to "bug-hash-union at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hash-Union>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.SUPPORTYou can find documentation for this module with the perldoc command.perldoc Hash::Union You can also look for information at:
COPYRIGHT & LICENSECopyright 2009 Oleg A. Mamontov, all rights reserved.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |