Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
Payne #1
config file
Hi,
I have a project that I need to write and in the past I would hard code
a lot of information in pages that I should have put into a config file.
I am wanting to know if there a website that example how to write a
config file and how to the php call them.
Thanks
Chuck
Payne Guest
-
Error loading XML file c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config
I had many ASP.NET web applications that I created before I had to rebuild my machine. After a fresh install of XP Pro, VS.NET 2003, etc, I now... -
config file: a) what Module ? b) conditionals in config (for multiple hosts)
Hi, a) I am looking for a module to handle config files. There are a number of these modules, like AppCconig. Any consensus about The Right... -
[PHP] config file
Payne said the following on 9/19/2003 11:23 AM>> take a look at parse_ini() function -
reference.vb...and the web.config file?
What is the reference.vb file. How is it created? Can it or is there a reason for it to be modified? And the web. config file? For tracing, I... -
Web.Config File
Hi Jason, No, you can't restrict certain IP addresses or IP masks via the web.config. You can write your own httpHandler and likely do this, but... -
Rod #2
Config file
What is the best way to read a config file for a perl script. I have
some very ugly code that can do it, but I would like to find something
cleaner.
Thanks,
Rod.
Rod Guest
-
Dan Muey #3
RE: Config file
> What is the best way to read a config file for a perl script. I have
That depends very very much on the format of the config file.> some very ugly code that can do it, but I would like to find
> something
> cleaner.
You could use open() to read the file and parse it's contents
into some kind of useable data structure (variables, array, hash,...)
One of my favorite ways though is to put the goods I use in lots and
lots of places into a module and import the goods I need:
use lib '/home/me/myperlmodules';
use MySuperProgramConfig; # has all the stuff I want in @EXPORT
Sorry I couldn't be more specific, I have no idea what your config
file is like or what kind of info you're trying to get into the program
:)
Dmuey
>
> Thanks,
> Rod.Dan Muey Guest
-
Tom Kinzer #4
RE: Config file
I've used Config::IniFiles before and it works very nice, especially nice if
you do a tie into a hash for all your values.
[url]http://search.cpan.org/~wadg/Config-IniFiles-2.38/IniFiles.pm[/url]
-Tom Kinzer
-----Original Message-----
From: Rod [mailto:scriptmonkey@iowatelecom.net]
Sent: Tuesday, December 02, 2003 7:55 AM
To: beginners
Subject: Config file
What is the best way to read a config file for a perl script. I have
some very ugly code that can do it, but I would like to find something
cleaner.
Thanks,
Rod.
--
To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
For additional commands, e-mail: [email]beginners-help@perl.org[/email]
Tom Kinzer Guest
-
Luke Bakken #5
RE: Config file
> What is the best way to read a config file for a perl script. I have
I've used Config::General for several production projects and it works> some very ugly code that can do it, but I would like to find
> something
> cleaner.
quite well.
Luke
Luke Bakken Guest
-
Drieux #6
Re: Config file
On Dec 2, 2003, at 7:55 AM, Rod wrote:
I like the Config::General module someone has recommended,> What is the best way to read a config file for a perl script.
> I have some very ugly code that can do it, but I would like
> to find something cleaner.
amongst the trade offs that one will have to resolve is how
much Stuff do you need, and how to access that stuff, and
how much 'generic parsing' as opposed to tailered parsing.
remember that 'art is in the eye of the beholder'.
My favorite way is in an OO'ish form where I start with
something on the order of
my $web_config = new Dtk::...::ToolConf;
Then actually read them with
#------------------------
#
sub set_values
{
my ($me) = @_;
my $error = $me->webadmin_conf_file_name() unless $me->{file};
return $error if (ref($error) eq 'HASH');
open(FD, $me->{file}) or return({runtime_error =>
"unable to open config file $me->{file} : $!\n"});
while(<FD>)
{
chomp;
s/#.*//; # strip comments
next if /^\s*$/;
if (/=/ ) {
s/\s+=/=/; # clean spaces before =
s/=\s+/=/; # clean spaces after =
s/\s+$//; # clean trailing spaces
s/^\s+//; # clean leading spaces
my ($k, $v) = split(/=/);
$me->{$k} = $v;
}
}
close(FD);
$me->{values_set} = 1;
0;
} # end of set_values
And of course have a list of named accessors:
#------------------------
# The Accessors
#------------------------
sub config_sufix { $_[0]->{config_sufix} }
sub config_dir { $_[0]->{config_dir} }
sub bin_dir { $_[0]->{bin_dir} }
sub webmin_root { $_[0]->{web_admin_root} }
sub webmin_port { $_[0]->{web_admin_port} }
sub db_url { $_[0]->{db_url} }
and some other junk that has to do with sanity checking,
and displaying them so that the config file can be
edited and updated, and yada-yada-yada.
{ yes, could have used AutoLoader - tried that,
it didn't take me where I wanted to go.... }
A part of the question you really want to ask
is how complex a config file do you want to begin
with, and can you live with the issues that come
from using a hash where the 'key/value' pairs are
accessed directly by the calling code.
Do you need to have complex configuration stuff,
if so why not lookt at the LibXml approach...
ciao
drieux
---
Drieux Guest
-
Wiggins D Anconia #7
Re: Config file
>
> On Dec 2, 2003, at 7:55 AM, Rod wrote:Particularly I suggest XML::Simple it allows you to both create your>
> Do you need to have complex configuration stuff,
> if so why not lookt at the LibXml approach...
>
config file and read in your config file using standard Perl data
constructs and is reasonably quick for smaller purposes. I have also
had luck with AppConfig since it hasn't been mentioned yet, at least I
don't think. I have found XML the best bet for arbitrarily deep nested
config files though...
Whatever you decide, use a module!
[url]http://danconia.org[/url]
Wiggins D Anconia Guest
-
R. Joseph Newton #8
Re: Config file
Rod wrote:
It depends on how the config file is set up. Asuming that your config> What is the best way to read a config file for a perl script. I have
> some very ugly code that can do it, but I would like to find something
> cleaner.
>
> Thanks,
> Rod.
file is a simple name= value per line file, it is very simple:
my $options = {};
open IN, $option_file_name or die "Could not open ini file: $!";
while (defined my $line = IN) {
next unless $line;
my ($key, $value) = split /\s*=\s*/, $line;
$options->{$key} - $value;
}
close IN;
Joseph
R. Joseph Newton Guest
-
Twocans #9
config file
Hi yea,
I am using a PC XP SP2 only me as a user on the machine,
In my Documents and Settings Dir I have both a Administrator and an All
User Dir.
I find that in all I have 2 config folders.
C:\Documents and Settings\Administrator\Application
Data\Macromedia\Dreamweaver 8\Configuration <<<< that config fle
is only 5 odd meg
and
C:\Documents and Settings\All Users\Application Data\Macromedia\Dreamweaver
8\Configuration <<<< this config file is 40 odd meg
when I back up my config file I usually back up the config in my All users
dir, but I was wondering should i be backing up both.
should I be having 2 config files.
regards
Kenny
Twocans Guest



Reply With Quote

