05-16-2008
Perl config file Help
HI
I have a config file (ip.config)that has the following fields with colon as delimeter.
yahoo.com:1919 ( host and port number)
rediffmail.com:2020
gmail.com:2121
How to read it in a perl script. I need to parse the host and port number in the perl script using split function ...Please Help
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
can anyone help me understanding the following code
my %config;
open my $config, '<', 'config.txt' or die $!;
while(<$config>) {
chomp;
(my $key, my @value) = split /=/, $_;
$config{$key} = join '=', @value;
} (5 Replies)
Discussion started by: Harikrishna
5 Replies
2. Shell Programming and Scripting
Hi
In My config file i have 12.122.12.111:2000
A host and a port number.
To read the config file i have written in a perl script like this
my %config;
open my $config, '<','config' or die "Failed to read file :$!";
Its running fine in HP-UX but showing error in solaris... (2 Replies)
Discussion started by: Harikrishna
2 Replies
3. Shell Programming and Scripting
Hi,
I want to use a config file as the base file and parse over the values of country and city parameters in the config file and generate separate config files as explained below.
I will be using the config file as mentioned below:
(config.txt)
country:a,b
city:1,2
type:b1... (1 Reply)
Discussion started by: clazzic
1 Replies
4. Shell Programming and Scripting
Hi!
I have a need to do this in Perl.
script.pl -config file
The script would be doing a wget/LWP on a URL which is defined in the config file.
So when I run the script it should return either one of these conditions -
1) OK with exit status 0.
Should also print "wget URL"
2)... (6 Replies)
Discussion started by: jacki
6 Replies
5. Shell Programming and Scripting
Hi,
i'm trying to parse a config file that have alot of rows similar to this one:
Example value value value
What i want to do is to split and save the row above in a hash, like this:
Example = value value value
Basically i want to split on the first whitespace after the first... (3 Replies)
Discussion started by: mikemikemike
3 Replies
6. Shell Programming and Scripting
Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated.
script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made.
OS :Susi linux ver 10.3.
... (4 Replies)
Discussion started by: muraliinfy04
4 Replies
7. Shell Programming and Scripting
Folks,
I'm a perl moron, so please speak very slowly. : )
I'm modifying a build script that starts up an apache server. Now there is a .config file that hardcodes an old webserver path like this c:\oldWebserver. Now I don't want that hardcoded value, rather wish to use an... (3 Replies)
Discussion started by: MarkoRocko
3 Replies
8. Shell Programming and Scripting
Hi,
I want to configure some values in config file like below
work_dir /home/work
csv_dir /home/csv
sql_dir /home/sqls
reportfirst yes
and i want to store each value in variable to use it further in my my perl program ??
any thought on this(i am new to perl) ?
... (2 Replies)
Discussion started by: raghavendra.nsn
2 Replies
9. Shell Programming and Scripting
Hi All,
Can anyone please explain me how to read data from config file in Perl.
Suppose i have a config file named cfile. The data in config file is
name=parth
lname=mittal
user=2007
hostname=fluoride
username=parthmittal
password=XXXXXX
account=unix
url=www.unix.com
... (2 Replies)
Discussion started by: parthmittal2007
2 Replies
10. Shell Programming and Scripting
Hi can anybody help me in how to read .config file in Perl, which module is used, and some help in coding. (10 Replies)
Discussion started by: parthmittal2007
10 Replies
LEARN ABOUT DEBIAN
runapp
RunApp(3pm) User Contributed Perl Documentation RunApp(3pm)
NAME
RunApp - A generic module to run web-applications
SYNOPSIS
use RunApp '-chdir';
use RunApp;
use RunApp::Apache;
my $cmd = shift || 'development';
my $config = { var => 'value', app_apache => { var_for_apache => 'value'} };
RunApp->new (app_apache => RunApp::Apache->new
(root => catfile (cwd, $_),
httpd => '/path/to/httpd'),
my_daemon => RunApp::Control::AppControl->new
(binary => '/path/to/daemon',
args => ['--daemon'],
pidfile => '/path/to/daemon.pid',
)
)->$cmd ($config);
DESCRIPTION
"RunApp" streamlines the process for configuring applications that requires one or more web servers and/or other daemons, during develop-
ment or deployment.
It builds the config files required by the services from the $config hash, such as apache's httpd.conf.
OPTIONS
use RunApp '-chdir';
use RunApp qw(-chdir ..);
This will cause the your script to "chdir" to the base directory. If it's a symbolic link it will be resolved and you will be in the
directory of where the original script is. The "lib" directory will be added into @INC, and you can use the modules in that path.
It also takes an optional relative path if want the script to chdir to somewhere else.
This makes it possible for symlinking the your runapp script into system's rc.d startup directory.
CONSTRUCTOR
new (@services)
@services is actually an hash, with keys being the name of the service, and values being "RunApp::Control" objects. Use an array instead
of a hash here to retain the order of dispatching.
The names are used to pick config from the hash, which will be flatten into top level of the config hash, when running "build" for the each
service.
METHODS
$self->development ($conf)
Runs "build" and "start", and then waits for SIGINT to <stop> the servers.
AUTOLOAD
All other methods are dispatched to the "RunApp::Control" objects in the order called in CONSTRUCTOR. Note that this is done with
RunApp::Control dispatching to the "dispatch" method.
SEE ALSO
RunApp::Apache, RunApp::Control::AppControl, App::Control
AUTHORS
Chia-liang Kao <clkao@clkao.org>
Refactored from works by Leon Brocard <acme@astray.com> and Tom Insam <tinsam@fotango.com>.
COPYRIGHT
Copyright (C) 2002-5, Fotango Ltd.
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
perl v5.8.8 2008-01-09 RunApp(3pm)