in reply to Re^2: Recover a path from a config file
in thread Recover a path from a config file
Hi Chaoui05,
i cannot modify my config.file
With Perl you can ;-)
There are several other ways to solve this (maybe even PadWalker), and personally I think the following is a hack that's not very nice, but it works as long as your config file only contains one declaration of my $folder...
my $conf_str = do { open my $fh, '<', 'work.conf' or die $!; local $/; <$fh> }; # slurp ( $conf_str =~ s/\bmy\s*\$folder\b/our \$folder/g )==1 or die q{Failed to match "my $folder" exactly once}; our $folder; my $config = eval $conf_str;
Hope this helps,
-- Hauke D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Recover a path from a config file
by Chaoui05 (Scribe) on Jun 06, 2016 at 13:12 UTC | |
by haukex (Archbishop) on Jun 06, 2016 at 13:39 UTC | |
by Chaoui05 (Scribe) on Jun 06, 2016 at 15:22 UTC |