File: munge_config

package info (click to toggle)
libtime-y2038-perl 20100403-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 168 kB
  • ctags: 104
  • sloc: ansic: 811; perl: 497; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 617 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl -w

use Config;
use Module::Build;

my $build = Module::Build->current;

my %config = (%Config, $build->notes);

my $input_file  = shift;
my $output_file = shift;


open my $input_fh, $input_file          or die "Can't open $input_file: $!";
open my $output_fh, ">$output_file"     or die "Can't open $output_file: $!";
print $output_fh <<"END";
/*
 * !!! DO NOT EDIT THIS FILE!!!
 * This file was generated from $input_file.
 * Edit that and rerun make to regenerate.
 */

END

while(<$input_fh>) {
    my $matched = s{%%(.*)%%}{defined $config{$1} ? $config{$1} : ''}eg;

    print $output_fh $_;
}