List Info

Thread: Re: Loading variables from a file.




Re: Loading variables from a file.
country flaguser name
Czech Republic
2008-03-25 17:32:35

From: "Kevin Patterson&quot; < kpatters%40berkeley.edu">kpattersberkeley.edu>
> Is there a way to place all of your variables in a file then load the
> variables into your program from that file???

You should NOT place all your variables anywhere. Most of the
variables within your program should have a fairly small scope (the
part of the program where they exist) and it makes no sense
whatsoever to put them anywhere.

If you want to store some DATA outside the program you may have a
look at some of the Config:: modules on CPAN, or the XML:: modules or
YAML. You may also specify the data in the "perl format&quot; and load
them using "use&quot;, "require" or "do&quot; (look up those statements in the
Perl documentation) but quite often this is not the best thing to do.
Especially if you need other people to be able to edit the files.

Jenda
===== Jenda%40Krynicky.cz">JendaKrynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

__._,_.___
.

__,_._,___
RE: Loading variables from a file.
country flaguser name
United States
2008-03-26 07:08:04

Thanks.

I read the require option and it works great for me..

Other people wont need to edit these variables..

I just got tired of writing the same variable in 10 different programs..

_____

From: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com [mailto: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com]
On Behalf Of Jenda Krynicky
Sent: Tuesday, March 25, 2008 3:33 PM
To: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com
Subject: Re: [PBML] Loading variables from a file.

From: "Kevin Patterson&quot; <kpattersberkeley. <mailto:kpatters%40berkeley.edu>
edu>
&gt; Is there a way to place all of your variables in a file then load the
> variables into your program from that file???

You should NOT place all your variables anywhere. Most of the
variables within your program should have a fairly small scope (the
part of the program where they exist) and it makes no sense
whatsoever to put them anywhere.

If you want to store some DATA outside the program you may have a
look at some of the Config:: modules on CPAN, or the XML:: modules or
YAML. You may also specify the data in the "perl format&quot; and load
them using "use&quot;, "require" or "do&quot; (look up those statements in the
Perl documentation) but quite often this is not the best thing to do.
Especially if you need other people to be able to edit the files.

Jenda
===== JendaKrynicky. <mailto:Jenda%40Krynicky.cz> cz === http://Jenda.
<http://Jenda.Krynicky.cz> Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )