• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

exporting vars from nested "do file;"

I have a configuration file I read using
  do "config.rc";
Usually it just contains some assignments. But now I need to read another file from this one. When I put inside config.rc the statement
  do $nested_config_file;
then the variables assigned inside the nested config file are not defined in the main program.

How can I make the variables defined in the nested config file available to the main program, without changing the main program code?
0
yonat
Asked:
yonat
  • 3
  • 2
1 Solution
 
ozoCommented:
How are the variables assigned inside the nested config file?
How are you setting $nested_config_file ?
0
 
yonatAuthor Commented:
The nested config file is just a series of
    $some_var = 'some_value';
assignments.

$nested_config_file is based on some CGI parameter, and I checked and made sure that it does indeed hold the right path, so I know this is not the problem.
0
 
yonatAuthor Commented:
Just to make sure: by Perl's definition, are the variables SUPPOSED to be available to the main program? I mean, should I just look for some little error somewhere, or do I need write some explicit code to export them?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
ozoCommented:
The variables should be available to the main program.
Can you post some sample code that does not do what you expect?
0
 
ahoffmannCommented:
if say CGI, is your perl program run by a webserver?
WHen will the nested rc file be generated?
0
 
yonatAuthor Commented:
Thanks for your help guys. After understanding that this is not a Perl problem, I found out that I did not set the permissions for the nested config file correctly. Now everything works!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now