Solved

exporting vars from nested "do file;"

Posted on 2002-05-26
6
155 Views
Last Modified: 2013-11-18
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
Comment
Question by:yonat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 7036457
How are the variables assigned inside the nested config file?
How are you setting $nested_config_file ?
0
 
LVL 5

Author Comment

by:yonat
ID: 7036487
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
 
LVL 5

Author Comment

by:yonat
ID: 7036494
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 84

Accepted Solution

by:
ozo earned 150 total points
ID: 7036627
The variables should be available to the main program.
Can you post some sample code that does not do what you expect?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7036817
if say CGI, is your perl program run by a webserver?
WHen will the nested rc file be generated?
0
 
LVL 5

Author Comment

by:yonat
ID: 7037596
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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question