>>>>> "MS" == Martin Spinassi <martins.li...@gmail.com> writes:
<ain't seen gorrebeeck's post yet but this is for him> MS> On Mon, 2009-08-10 at 15:37 -0400, Gorrebeeck, Robert wrote: >> Martin >> >> What you want to do is use the require function >> >> require "directory/filename"; he can still call use. there is no difference from a scoping point of view. their primary difference is when they get called (use at compile time and require at run time) >> Within your config file >> >> You would set up the variables like this in your config file >> #VARIABLES (home directory) - make sure you use the keyword 'our' >> our $home_directory="/home/test/customer"; you haven't shown how to set up the vars. i suggest a single hash which is easy to access, keep isolated, modify, scan, etc. vs a list of individual variables. also you can export the single hash easily and that isn't as easy for a set of scalar vars. >> Then just reference whatever your called your variable in your config >> file again, you don't show how that is done. >> #to change to our home directory >> system("cd $home_directory"); regardless of how you do the config, that call is very wrong and won't do a thing. cd affects the process that calls it and this would be the subprocess created by system. then that process dies and the main perl process is still where it was. perl has a builtin chdir for this. MS> Thanks Robert! That is exactly what I was searching for. MS> It's working I don't have any issues with that :), but I'd like to know MS> something...can I make it work with "use strict"? as i said, above if you use a single hash and export it, you can get by strict easily. MS> Using your example would say: MS> Global symbol "$home_directory" requires explicit package name at MS> test.pl MS> That appears even if "require" if over "use strict". require has nothing to do with strict. strict is a file scoped pragma so it affects all declarations in the current file. learn about exporting (easy to do) and export a single hash as i said. otherwise you will need to export all your config scalars and spend all your time editing that file. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Free Perl Training --- http://perlhunter.com/college.html --------- --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/