List Info

Thread: RE: Loading variables from a file.




RE: Loading variables from a file.
country flaguser name
Hungary
2008-03-26 07:14:10

I'M JUST CURIOUS. WHAT DID YOU DECIDE TO USE? A PERL FILE FULL OF VARIABLES, THEN USE IT€¦ OR THE CONFIG FILE / XML / CONFIG MODULE?



FROM: PERL-BEGINNER%40YAHOOGROUPS.COM">PERL-BEGINNERYAHOOGROUPS.COM [MAILTO: PERL-BEGINNER%40YAHOOGROUPS.COM">PERL-BEGINNERYAHOOGROUPS.COM] ON BEHALF OF KEVIN PATTERSON
SENT: WEDNESDAY, MARCH 26, 2008 1:08 PM
TO: PERL-BEGINNER%40YAHOOGROUPS.COM">PERL-BEGINNERYAHOOGROUPS.COM
SUBJECT: RE: [PBML] LOADING VARIABLES FROM A FILE.



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> [MAILTO: PERL-BEGINNER%40YAHOOGROUPS.COM">PERL-BEGINNERYAHOOGROUPS.COM <MAILTO:PERL-BEGINNER%40YAHOOGROUPS.COM> ]
ON BEHALF OF JENDA KRYNICKY
SENT: TUESDAY, MARCH 25, 2008 3:33 PM
TO: PERL-BEGINNER%40YAHOOGROUPS.COM">PERL-BEGINNERYAHOOGROUPS.COM <MAILTO:PERL-BEGINNER%40YAHOOGROUPS.COM>
SUBJECT: RE: [PBML] LOADING VARIABLES FROM A FILE.

FROM: "KEVIN PATTERSON&QUOT; <KPATTERSBERKELEY. <MAILTO:KPATTERS%40BERKELEY.EDU>
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
===== 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]




[NON-TEXT PORTIONS OF THIS MESSAGE HAVE BEEN REMOVED]

__._,_.___
.

__,_._,___
RE: Loading variables from a file.
country flaguser name
United States
2008-03-27 14:20:35

I just used a files called perlvars.txt

I may have to rethink the require option tho.

I found out that the require used the variable on the first notice of a
variable.

But if the same variable is used later on in the code, it did not recognize
it..

_____

From: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com [mailto: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com]
On Behalf Of Gergely Brautigam
Sent: Wednesday, March 26, 2008 5:14 AM
To: perl-beginner%40yahoogroups.com">perl-beginneryahoogroups.com
Subject: RE: [PBML] Loading variables from a file.

I'm just curious. What did you decide to use? A perl file full of variables,
then use it. Or the config file / xml / config module?

From: perl-beginner <mailto:perl-beginner%40yahoogroups.com>
yahoogroups.com [mailto:perl-beginner
<mailto:perl-beginner%40yahoogroups.com> yahoogroups.com] On Behalf Of Kevin
Patterson
Sent: Wednesday, March 26, 2008 1:08 PM
To: perl-beginner <mailto:perl-beginner%40yahoogroups.com> yahoogroups.com
Subject: RE: [PBML] Loading variables from a file.

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 <mailto:perl-beginner%40yahoogroups.com>
yahoogroups.com <mailto:perl-beginner%40yahoogroups.com>
[mailto:perl-beginner <mailto:perl-beginner%40yahoogroups.com>
yahoogroups.com <mailto:perl-beginner%40yahoogroups.com> ]
On Behalf Of Jenda Krynicky
Sent: Tuesday, March 25, 2008 3:33 PM
To: perl-beginner <mailto:perl-beginner%40yahoogroups.com> yahoogroups.com
&lt;mailto:perl-beginner%40yahoogroups.com&gt;
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. <http://Jenda.Krynicky.cz> 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]

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

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

__._,_.___
.

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

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