05-19-2008
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 LINUX
config_data
CONFIG_DATA(1) Perl Programmers Reference Guide CONFIG_DATA(1)
NAME
config_data - Query or change configuration of Perl modules
SYNOPSIS
# Get config/feature values
config_data --module Foo::Bar --feature bazzable
config_data --module Foo::Bar --config magic_number
# Set config/feature values
config_data --module Foo::Bar --set_feature bazzable=1
config_data --module Foo::Bar --set_config magic_number=42
# Print a usage message
config_data --help
DESCRIPTION
The "config_data" tool provides a command-line interface to the configuration of Perl modules. By "configuration", we mean something akin
to "user preferences" or "local settings". This is a formalization and abstraction of the systems that people like Andreas Koenig
("CPAN::Config"), Jon Swartz ("HTML::Mason::Config"), Andy Wardley ("Template::Config"), and Larry Wall (perl's own Config.pm) have
developed independently.
The configuration system emplyed here was developed in the context of "Module::Build". Under this system, configuration information for a
module "Foo", for example, is stored in a module called "Foo::ConfigData") (I would have called it "Foo::Config", but that was taken by all
those other systems mentioned in the previous paragraph...). These "...::ConfigData" modules contain the configuration data, as well as
publically accessible methods for querying and setting (yes, actually re-writing) the configuration data. The "config_data" script (whose
docs you are currently reading) is merely a front-end for those methods. If you wish, you may create alternate front-ends.
The two types of data that may be stored are called "config" values and "feature" values. A "config" value may be any perl scalar,
including references to complex data structures. It must, however, be serializable using "Data::Dumper". A "feature" is a boolean (1 or
0) value.
USAGE
This script functions as a basic getter/setter wrapper around the configuration of a single module. On the command line, specify which
module's configuration you're interested in, and pass options to get or set "config" or "feature" values. The following options are
supported:
module
Specifies the name of the module to configure (required).
feature
When passed the name of a "feature", shows its value. The value will be 1 if the feature is enabled, 0 if the feature is not enabled,
or empty if the feature is unknown. When no feature name is supplied, the names and values of all known features will be shown.
config
When passed the name of a "config" entry, shows its value. The value will be displayed using "Data::Dumper" (or similar) as perl code.
When no config name is supplied, the names and values of all known config entries will be shown.
set_feature
Sets the given "feature" to the given boolean value. Specify the value as either 1 or 0.
set_config
Sets the given "config" entry to the given value.
eval
If the "--eval" option is used, the values in "set_config" will be evaluated as perl code before being stored. This allows moderately
complicated data structures to be stored. For really complicated structures, you probably shouldn't use this command-line interface,
just use the Perl API instead.
help
Prints a help message, including a few examples, and exits.
AUTHOR
Ken Williams, kwilliams@cpan.org
COPYRIGHT
Copyright (c) 1999, Ken Williams. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Module::Build(3), perl(1).
perl v5.12.4 2013-03-18 CONFIG_DATA(1)