Thanks, Frankie,

But I am only trying to maintain a perl program written by someone else, and as readers of this newsgroup will know I strongly deprecate such unplanned non-integrated jack-in-the-box, unsafe languages as perl in favout of such beuatiful creations as, say, gprolog for Linux or Windows or Visual Prolog for Windows.   Languages with inbuilt AI for me!

Yes, I should rewrite the troels.rsync programs, but lack present motivation to get started <g>  <hint, hint, hint>.

[Apologies to Anne for thr HTML}.

Frankie wrote:
Yes,
 
Nowdays, I give all my external files their own package namespace.
 
For my config files, I put a sub in it.. a sub contains all the config variables, and  returns all the config values, which I assign to the variables in the main program.
 
Ie (in the mainscript file body):
 
#!/use/bin/perl -T
 
use strict;
use config_package;
 
my ($var1, $var2, $var3, $var4, $etc) = config_package::config_sub();
 
That way the scope is whatever you want it to be..
 
For that matter, you could pull the lot into a scoped  hash and use them as you need them.
 
As an added benefit, its very mod_perl friendly.
 
 
regards
 
Franki
 
 
 
 
 
 
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Ron Stodden
Sent: Friday, 22 August 2003 7:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [expert] Perl question - include?

Frankie wrote:
try:

require filename.pl;

rgds

Franki

That clue gave the solution.

But:

1.   Syntax is
require ("<filename>");

2.  Unfortunately, my $whatever definitions do not survive transition into the required (included) file.
In my case that was easily overcome by shifting those definitions into the required file, which means they probably don't survive transition back into the main program, which is in my case, rather good (the reduced scope is safer).

Thanks!

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Ron Stodden
Sent: Friday, 22 August 2003 2:45 PM
To: Mandrake Expert
Subject: [expert] Perl question - include?


I've searched the perl man pages fruitlessly, so let me ask of all you 
perl enthusiasts:

How do you do such a simple thing as to include another perl source file 
at some point in a perl source file?

No, "include" doesn't work.

-- 
Ron. [Melbourne, Australia]
"If you keep a green bough in your heart, the singing bird will come"
Get Fastest Mandrake downloader, English-only, from:
http://members.optusnet.com.au/ronst/       Click all ye faithful!




    

  

Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com

-- 
Ron. [Melbourne, Australia]
"If you keep a green bough in your heart, the singing bird will come"
Get Fastest Mandrake downloader, English-only, from:
http://members.optusnet.com.au/ronst/       Click all ye faithful!
    

-- 
Ron. [Melbourne, Australia]
"If you keep a green bough in your heart, the singing bird will come"
Get Fastest Mandrake downloader, English-only, from:
http://members.optusnet.com.au/ronst/       Click all ye faithful!
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to