• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

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