Sponsored Content
Full Discussion: using perl config files
Top Forums Shell Programming and Scripting using perl config files Post 302493554 by CCFP on Thursday 3rd of February 2011 04:43:16 AM
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..
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Config::GitLike::Git(3pm)				User Contributed Perl Documentation				 Config::GitLike::Git(3pm)

NAME
Config::GitLike::Git - load Git configuration files SYNOPSIS
use Config::GitLike::Git; my $config = Config::GitLike::Git->new; $config->load("/path/to/repo"); DESCRIPTION
This is a modification of Config::GitLike to look at the same locations that Git writes to. Unlike with Config::GitLike, you do not need to pass a confname to its constructor. This module also enables the Config::GitLike option to maintain git compatibility when reading and writing variables. "load" in Config::GitLike should be passed path to the top level of a git repository -- this defaults to the current directory. It will append ".git" as necessary. It supports both bare and non-bare repositories. METHODS
This module overrides these methods from "Config::GitLike": dir_file The per-directory configuration file is .git/config user_file The per-user configuration file is ~/.gitconfig global_file The per-host configuration file is /etc/gitconfig is_git_dir Returns true if a file contains the necessary files (as git would reckon it) for the path to be a git repository. load_dirs Loads the relevant .git/config file. SEE ALSO
Config::GitLike LICENSE
You may modify and/or redistribute this software under the same terms as Perl 5.8.8. COPYRIGHT
Copyright 2010 Best Practical Solutions, LLC AUTHORS
Alex Vandiver <alexmv@bestpractical.com>, Christine Spang <spang@bestpractical.com> perl v5.14.2 2012-02-16 Config::GitLike::Git(3pm)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy