calling perl commands in shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting calling perl commands in shell
# 1  
Old 11-10-2010
calling perl commands in shell

i have four commands
1. perl -MCPAN -e shell
2. o conf prerequisites_policy follow
3.
o conf commit

4. exit

I am attempting to streamline a bunch of yum commands and cpan installations and want to remove the confirmation portion of the cpan these four commands will do just that. my question. If it is possible, how do i place these into the shell script to run these commands after doing the yum install but before doing the cpan install

NOTE: I must use cpan instead of searching for these modules in rpms as the program they are used by has an issue with using rpms over the cpan modules.

ex.
Code:
#!/bin/sh
# File: rpm_prereq.sh

yum install -y glibc-devel
yum install -y httpd perl mod_perl mod_ssl
yum install -y mysql mysql-server
yum install -y nscd rsyslog
yum install -y gcc make
yum install -y rrdtool htmldoc

service mysqld start

(place those commands here)
cpan Apache::ASP App::Info Cache::Cache Crypt::PasswdMD5
cpan SBECK/Date-Manip-5.56.tar.gz
cpan DBD::mysql DBI
cpan JSON Linux::Inotify2 List::MoreUtils
cpan Locale::Maketext::Lexicon Locale::Maketext::Simple

any assistance will be grately appreciated.

Last edited by Scott; 11-10-2010 at 02:04 PM.. Reason: Use code tags, please...
# 2  
Old 11-10-2010
cpan prerequisites follow

In ~/.cpan/CPAN/ there is a file called MyConfig.pm. This is where your configuration is written when you type "o conf commit" at the cpan shell. You already have figured out the directive to set, "prerequisites_policy" and that should be set to "follow", which will automatically try and pull in any dependencies for you.

Once you have set that ( either in the cpan shell, or by editing ~/.cpan/CPAN/MyConfig.pm directly), why not just do this:
Code:
cpan install YAML::XS >> cpan.log 2>&1
cpan install JSON::XS >> cpan.log 2>&1

That should silence any messages to the screen and keep a record for you ( "cpan.log" ), in case anything blew up.
# 3  
Old 11-11-2010
I threw that in the config.pm file and also attempted all the cpan installs with it.

I noticed almost everything that originally would ask if i wanted to prepend pre-req. modules is no longer asking me, HOWEVER, it appears those modules fail (issue about the make install returns bad status.) shouldnt the follow policy automatically prepend for me?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling perl from shell script

I am calling a perl script from shell script. $ cat mah_appln_bkp_oln.ksh #!/bin/ksh . /udb/home/udbappln/.profile . /udb/home/udbappln/sqllib/db2profile Com=/udb/udbappln/utility/systemscripts/currentUMR perl $Com/backup.pl -d dbname --tsm --purgetsmcopies 21 --purgetsmlogs exit 0 ... (1 Reply)
Discussion started by: ilugopal
1 Replies

2. UNIX for Advanced & Expert Users

Calling PERL from a Korn shell script

I am currently in Afghanistan and do not have access to some of the resources I normally do back in the US. Just accessed this site and it looks promising! Hopefully you will not find my question too much of a waste of your time. I write mostly Korn Shell and PERL on Solaris systems for the... (2 Replies)
Discussion started by: mseanowen
2 Replies

3. Shell Programming and Scripting

How to accept arguments in shell script when calling in perl

I have a shell script like this: #!/bin/sh $PYTHON MetarDecoder.py < ../data/mtrs/arg1/arg2 And I'm calling it with this in perl: my $output = `./metar_parse.sh --options`; It's successful when I put in actual values for arg1 and arg2 in the shell script, but I'd like to pass arguments... (1 Reply)
Discussion started by: civilsurfer
1 Replies

4. Shell Programming and Scripting

Calling perl subroutine from shell script (sh)

Hi, ive a perl script, where it has a subroutine clear() in it, and i've one shell script which runs in background, from that shell script i wanted to call subroutine which is in perl script, that's perl script is not module, just simple script. Eg: perl script <test> #!... (4 Replies)
Discussion started by: asarunkumar
4 Replies

5. Shell Programming and Scripting

Calling perl script in shell program

How to call a perl script in shell program / shell scripting. PLS HELP ME (2 Replies)
Discussion started by: hravisankar
2 Replies

6. Shell Programming and Scripting

Calling GDB commands from Shell

Hi, I have just started off with the shell programming. I need to execute a GDB command from a shell script. I have been trying to get this working from quite sometime but not getting it quite right.I have this specific requirement that i read byte data from a file and write that data to the... (0 Replies)
Discussion started by: jsantosh
0 Replies

7. Shell Programming and Scripting

calling a shell script from perl

Hi all, Not sure if this is the right forum to post query regarding perl script. I have a perl script which internally calls a shell script. My problem is that the shell script should be passed command line arguments. I call a shell script from perl using: system("sript.sh"); How do... (3 Replies)
Discussion started by: gurukottur
3 Replies

8. Shell Programming and Scripting

Perl calling unix system commands

if ( system ("/bin/cat $File1 >> $File2") ) { print("#WARNING RAISED : /bin/cat File1 >> File2 - FAILURE!\n"); } I came across this code, would appreciate if someone can tell me if my understanding is correct? the perl code tell the system to cat file 1 into file 2, if command fails, print... (4 Replies)
Discussion started by: new2ss
4 Replies

9. Shell Programming and Scripting

Calling CGI Perl in Shell script [urgent]

All I want to call a perl program from my shell script. Please help me. I want to call through URL only. Like " http://www.test.com/CGI-bin/test?test=value" Please help to write this script. Thanx in advance. Thanking you Regards Deepak Xavier (0 Replies)
Discussion started by: DeepakXavier
0 Replies

10. Shell Programming and Scripting

Calling perl modules from shell scritps

hi, Is it possible to call a perl function from a perl module from within a shell script. I have a similar requirement. Thanks in advance, Kavitha (1 Reply)
Discussion started by: kavitha
1 Replies
Login or Register to Ask a Question