Skip to content

Instantly share code, notes, and snippets.

@goblin
Created February 2, 2013 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goblin/4699075 to your computer and use it in GitHub Desktop.
Save goblin/4699075 to your computer and use it in GitHub Desktop.
moj konfig manadżment
#! /usr/bin/perl
use strict;
use warnings;
use Text::Template qw/fill_in_file/;
use Hash::Merge qw/merge/;
use YAML qw/Load LoadFile/;
use IO::All;
my $desc = '';
while(<>) {
$desc .= $_;
}
$desc = Load($desc);
my $data = {};
foreach my $datafile (@{$desc->{data}}) {
$data = merge($data, LoadFile($datafile));
}
foreach my $cfgfile (keys %{$desc->{files}}) {
io($cfgfile) < fill_in_file($desc->{files}->{$cfgfile}, HASH => $data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment