using perl config files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting using perl config files
# 1  
Old 02-03-2011
using perl config files

Hi,

I have 2 perl SubRoutines (sub 1 and sub 2). I created two perl modules for these (Sub1.pm and Sub2.pm).

How can I include these in a config file (say Config.cfg) and call the config file in my main script Rename.pl to use the 2 subroutines?

Right now here are the content of Config.cfg
Code:
#Config.cfg
#!/usr/bin/perl
$InputRename = Sub1.pm
$OutputRename = Sub2.pm

I'm calling this in Rename.pl by doing this
Code:
require config.cfg;
.
.
.
.
InputRename();
.
.
.
.
OutputRename();

I'm new at Perl. Please help.

Thank You.

Last edited by CCFP; 02-03-2011 at 06:36 AM..
# 2  
Old 02-04-2011
I seem to recall, at the front of many perl scripts, invoking libraries like yours and then immediately testing them else die.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

(VS 2008) New build config looking files from other folder build config

Hi Team, My new build configuration always looking for the files from the build where i copied from. please help me to resolve this. I am using Visual studio 2008.It has Qt 4.8. plugins,qml,C++ development I created new debug_new build configuration with additional preprocessor from the... (1 Reply)
Discussion started by: SA_Palani
1 Replies

2. Shell Programming and Scripting

.Config file in perl

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

3. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

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

4. UNIX for Advanced & Expert Users

perl -V Can't locate Config.pm in @INC

Hi guys I have an issue in my sum server . I have perl installed in my machine and when i enter perl -version i get the verson on perl 10.0 but when i enter perl -V i get an error message "perl -V Can't locate Config.pm in @INC" I would appreciate if some one had faced this issue to share... (1 Reply)
Discussion started by: mohdaleem
1 Replies

5. Shell Programming and Scripting

parsing config file to create new config files

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

6. Shell Programming and Scripting

perl config parser

Hello. Can anybody help me with some sub on perl that can parse config like this: %CFG ( 'databases' => { 'db1' => 'db_11', 'db_12', 'db_13', 'db2' => 'db_21', 'db_22', 'db_23' } 'datafiles' => { 'datadir1' => 'datadir_11', 'datadir_12', 'datadir2' =>... (4 Replies)
Discussion started by: drack
4 Replies

7. Shell Programming and Scripting

Perl config file Help

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

8. Shell Programming and Scripting

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... (6 Replies)
Discussion started by: Harikrishna
6 Replies

9. Shell Programming and Scripting

Perl config file Help

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

10. Shell Programming and Scripting

Perl CGI to access / edit "root" owned config files

I am trying to write a CGI program which accesses UNIX configuration files and changes them as required. The thing is, I don't want the CGI program to be "root" owned - it's Perl based! Is there any way that the Perl CGI program can request a username and password - and then use this to... (1 Reply)
Discussion started by: WIntellect
1 Replies
Login or Register to Ask a Question