| 38 | | open my $fh, ($filename ||= "config.yml") or die "open: $filename: $!"; |
| | 38 | my $fh; |
| | 39 | |
| | 40 | unless (open $fh, ($filename ||= "config.yml")) { |
| | 41 | if (-e $filename) { die "open: $!"; } # real error |
| | 42 | |
| | 43 | # Makefile.PL uses PugsBuild::Config, which needs to read config.yml. |
| | 44 | # However, config.yml is generated by a Makefile target. |
| | 45 | # This whole block is a temporary workaround for the problem. |
| | 46 | require File::Copy; |
| | 47 | |
| | 48 | File::Copy::copy ('util/config-template.yml', 'config.yml') or die "Copy failed"; |
| | 49 | warn "Default build config file created. Edit your settings in config.yml."; |
| | 50 | |
| | 51 | open $fh, "config.yml" or die "open: $!"; |
| | 52 | }; |
| | 53 | |