How can I control the version of Perl used when submitting jobs to the grid?

I work with SGE (Sun Grid Engine) to send jobs to the grid. I also use perlbrewto manage my installed versions of Perl. I wrote some short scripts shthat I use to run a perl script, which requires a specific version of Perl (5.12.2) that looks something like this:

#!/bin/bash
#$-S /bin/bash

source /home/dave/.bash_profile
/home/dave/perl5/perlbrew/bin/perlbrew switch perl-5.12.2

/home/dave/scripts/proc_12.pl --in=/home/dave/in/in.store --dir=/home/dave/in/dir2 --params=/home/dave/in/params.p

Now, when I submit one task, everything works fine, but when I submit a lot, I start receiving error messages perlbrew, for example:

ln: creating symbolic link `current' to `perl-5.12.2': File exists
ln: creating symbolic link `/home/dave/perl5/perlbrew/bin/cpan' to `/home/dave/perl5/perlbrew/perls/current/bin/cpan': File exists
ln: creating symbolic link `/home/dave/perl5/perlbrew/bin/cpan2dist' to `/home/dave/perl5/perlbrew/perls/current/bin/cpan2dist': File exists
ln: cannot remove `/home/dave/perl5/perlbrew/bin/cpanp': No such file or directory
ln: cannot remove `/home/dave/perl5/perlbrew/bin/enc2xs': No such file or directory
ln: cannot remove `/home/dave/perl5/perlbrew/bin/find2perl': No such file or directory

So, I think the line /home/dave/perl5/perlbrew/bin/perlbrew switch perl-5.12.2is causing problems.

What can I do?

How can I execute my script using perl-5.12.2 (default is 5.8.8)?

+4
2

perlbrew switch perl-5.12.2 script, . .

script, Perl, perlbrew shebang:

#!/home/dave/perl5/perlbrew/perls/perl-5.12.2/bin/perl

use 5.012;
use warnings;
...

, :

chmod +x your_perl_program.pl
./your_perl_program.pl

, , perl script:

#!/bin/bash

/home/dave/perl5/perlbrew/perls/perl-5.12.2/bin/perl your_perl_program.pl


, , - perl-. ,

#!/bin/sh

# security risk
perl some_script.pl

# and not just perl
tar cvf archive.tar *.txt

# production risk
/home/dave/perl5/perlbrew/bin/perl some_other_script.pl

, perl tar, . $PATH, . , , perl perlbrew : (

, . :

#!/bin/sh

# fully qualified now.  Uses OS provided perl
/usr/bin/perl some_script.pl

# ditto
/usr/bin/tar cvf archive.tar *.txt

# this needs to run in perl 5.12.2
/home/dave/perl5/perlbrew/perls/perl-5.12.2/bin/perl some_other_script.pl

, ?

+2

perlbrew. , , . perlbrew , , perl . , , - , , Perl, , , .

perls , .

 $ perl5.12.2 /home/dave/scripts/proc_12.pl ...

, perl, ( , ):

 $ ./Configure -des -Dprefix=/usr/local/perls/perl-5.12.2
 $ make install

perls make_links script. Perl 5.12.2, ~/bin/perl5.12.2. . Perl, cpan:

 cpan5.12.2 Some::Module

, , .

+4

All Articles