in reply to Re: Recover a path from a config file
in thread Recover a path from a config file
The code from BrowserUk works fine for me. To eliminate the "only used once" warnings, just declare $folder in main:: as an "our" variable. An "our" variable gets into the global symbol table and can be accessed by anybody with the full name without any import/export adieu. Here is a modified main program...
work.conf as posted by browserUk:#! perl -slw use strict; use Data::Dump qw [ pp ]; our $folder; #to prevent "only used once" warnings our $config; do 'work.conf' or die $!; print $folder; # $folder is declared above, here in $main # not in file work.conf # since we are in main, don't need "full name" pp $::config; #can use full name here, but not necessary
works fine. Why isn't this good enough?$::folder = 'E:\FOLDER\Test\WEB'; $::config = { license => 'kit-licence.zip', programs => [ #template society =>\%program_work 'VIKTOR DESCRIPTION PRODUCT' => { name => 'VIKTOR ', parameters => [ Count_id => '06 (Viktor)', Birth_date => '1995-04-30', Marriage_date => '2014-05-26', Divorce_date => '2015-03-30', Activities_folder => $folder.'\VIKTOR\i +ndependent worker', Activities_format => 'Enterprise Format + (V35)', Description_File_from => $folder.'\VIKTOR\F +ILE\description.xlm', ] }, ] };
As an update, This back slash stuff for file names under Windows is not required. Use the forward slash. That is easier, more portable and completely allowed since I think at least Win98. The modern Window's command line is NOT DOS.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Recover a path from a config file
by Chaoui05 (Scribe) on Jun 06, 2016 at 15:35 UTC | |
by Marshall (Canon) on Jun 06, 2016 at 16:26 UTC | |
by Chaoui05 (Scribe) on Jun 07, 2016 at 08:10 UTC | |
by Marshall (Canon) on Jun 09, 2016 at 02:14 UTC |