André Fernandes dos Santos > YAML-Merge-Simple > YAML::Merge::Simple

Download:
YAML-Merge-Simple-0.01_01.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.01_01   Source  

NAME ^

YAML::Merge::Simple - Recursively merge two or more YAMLs, simply

VERSION ^

version 0.01_01

SYNOPSIS ^

    use YAML::Merge::Simple qw/ merge_files /;

    # a: 1
    my $yaml1 = shift;  
    
    # a: 100
    # b: 2
    my $yaml2 = shift;  
    
    # Merge with righthand hash taking precedence
    my $new_yaml = merge_files $yaml1,yaml2
    # $c (note: a: 100 has overridden a: 1)
    # a: 100
    # b: 2

DESCRIPTION ^

YAML::Merge::Simple will recursively merge two or more YAML files and return the result as a string with the content of a new YAML.

This is just a wrapper around Hash::Merge::Simple which uses YAML::XS to load the YAMLs into hashes, uses Hash::Merge::Simple to merge them and them uses YAML::XS again to dump the resulting hash back to YAML:

NAME ^

YAML::Merge::Simple - Recursively merge two or more YAMLs, simply

USAGE ^

Hash::Merge::Simple::merge_files( $file1, $file2, $file3, ..., $fileN )

Merge $file1 through $fileN, with the nth-most (rightmost) YAML taking precedence.

Returns a string with the YAML content of the merge.

Hash::Merge::Simple::merge( $string1, $string2, $string3, ..., $stringN )

Merge $string1 through $stringN, with the nth-most (rightmost) YAML taking precedence.

Returns a string with the YAML content of the merge.

SEE ALSO ^

Hash::Merge::Simple

ACKNOWLEDGEMENTS ^

This code is almost entirely based on the current implementation of Hash::Merge::Simple:

Robert Krimen robertkrimen@gmail.com

AUTHOR ^

Andre Santos <andrefs@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by Andre Santos.

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

syntax highlighting: