Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

standard configuration file 1

Status
Not open for further replies.

pwebonline

Programmer
Oct 9, 2002
6
AR
Hi everyone, I am developing a project which includes php and perl. It would be nice if I had a standard configuration file for both of them.
I was told it could be with two columns, key and value, and then have a subroutine that parses that data file and reads it into a hash.
Has anyone done this?
 
Hi PW,

File Contents
--------------------
"key1", "value1"
"key2", "value2"
.
.
.
"keyx", "valuex"
---------------------

In your init section read the file into a hash, and access the values using the keys. Its a straighforrard text file, so you can update the values at run-time, but you'll have to refresh the hash at regular intervals, in both PHP & Perl to ensure they're reading from the same "page".

Have fun
;P
 
Could you provide some sample code? I am a newbie to all this :) THank you in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top