YAML-PP-p5
YAML-PP-p5 copied to clipboard
anchors don't survive when files are included using the Include Schema
I'd like to use included yaml files to keep common configuration data. For example:
# db.yml
db : &db
host : hostname
port : 5432
And in the yaml files used by the applications,
# app1.yml
config : !include db.yml
args :
db : *db
But (perhaps unsurprisingly) the anchor is not carried over from the included file:
my $include = YAML::PP::Schema::Include->new;
my $yp = YAML::PP->new( schema => [ q{+}, 'Merge', $include ] );
$include->yp($yp);
p $yp->load_file('app1.yml');
Results in
No anchor defined for alias 'db' at .../YAML/PP/Parser.pm line 61.
at .../YAML/PP/Loader.pm line 94.
I find that I use anchors quite a bit to avoid duplication, and the ability for them to exist across included file boundaries would be quite helpful.